diff --git a/pkg/services/accounts.go b/pkg/services/accounts.go index 30ab592..7f6980d 100644 --- a/pkg/services/accounts.go +++ b/pkg/services/accounts.go @@ -20,7 +20,7 @@ func NotifyAccount(user models.Account, subject, content string, realtime bool, Subject: subject, Content: content, Links: links, - RecipientId: uint64(user.ID), + RecipientId: uint64(user.ExternalID), IsRealtime: realtime, IsImportant: false, }) diff --git a/pkg/services/messages.go b/pkg/services/messages.go index 6855e9b..5095577 100644 --- a/pkg/services/messages.go +++ b/pkg/services/messages.go @@ -3,6 +3,7 @@ package services import ( "git.solsynth.dev/hydrogen/messaging/pkg/database" "git.solsynth.dev/hydrogen/messaging/pkg/models" + "github.com/rs/zerolog/log" ) func CountMessage(channel models.Channel) int64 { @@ -77,7 +78,11 @@ func NewMessage(message models.Message) (models.Message, error) { ChannelID: message.ChannelID, }).Preload("Account").Find(&members).Error; err == nil { for _, member := range members { - _ = NotifyAccount(member.Account, "New message at "+message.Channel.Name, message.Content, true) + err = NotifyAccount(member.Account, "New message at "+message.Channel.Name, message.Content, true) + if err != nil { + log.Warn().Err(err).Msg("An error occurred when trying notify user.") + } + message, _ = GetMessage(message.Channel, message.ID) PushCommand(member.AccountID, models.UnifiedCommand{ Action: "messages.new",