diff --git a/pkg/services/accounts.go b/pkg/services/accounts.go index ac5ab8e..bcfa2e3 100644 --- a/pkg/services/accounts.go +++ b/pkg/services/accounts.go @@ -2,6 +2,7 @@ package services import ( "context" + "fmt" "git.solsynth.dev/hydrogen/messaging/pkg/database" "time" @@ -31,16 +32,16 @@ func GetAccountFriend(userId, relatedId uint, status int) (*proto.FriendshipResp }) } -func NotifyAccountMessager(user models.Account, subject, content string, realtime bool, forcePush bool, links ...*proto.NotifyLink) error { +func NotifyAccountMessager(user models.Account, t, s, c string, realtime bool, forcePush bool, links ...*proto.NotifyLink) error { ctx, cancel := context.WithTimeout(context.Background(), time.Second*5) defer cancel() _, err := grpc.Notify.NotifyUser(ctx, &proto.NotifyRequest{ ClientId: viper.GetString("passport.client_id"), ClientSecret: viper.GetString("passport.client_secret"), - Type: "notifications.messaging", - Subject: subject, - Content: content, + Type: fmt.Sprintf("messaging.%s", t), + Subject: s, + Content: c, Links: links, RecipientId: uint64(user.ExternalID), IsRealtime: realtime, diff --git a/pkg/services/calls.go b/pkg/services/calls.go index d68f27e..19e669d 100644 --- a/pkg/services/calls.go +++ b/pkg/services/calls.go @@ -100,6 +100,7 @@ func NewCall(channel models.Channel, founder models.ChannelMember) (models.Call, for _, member := range members { if member.ID != call.Founder.ID { err = NotifyAccountMessager(member.Account, + "incomingCall", fmt.Sprintf("Call in #%s", channel.Alias), fmt.Sprintf("%s started a new call", call.Founder.Account.Name), false, diff --git a/pkg/services/messages.go b/pkg/services/messages.go index 0c6e8ef..3aa6185 100644 --- a/pkg/services/messages.go +++ b/pkg/services/messages.go @@ -117,6 +117,7 @@ func NewMessage(message models.Message) (models.Message, error) { } err = NotifyAccountMessager(member.Account, + "incomingMessage", fmt.Sprintf("%s in #%s", message.Sender.Account.Nick, channel.Alias), fmt.Sprintf("%s", displayText), true,