🐛 Bug fixes of everything
This commit is contained in:
parent
cd61796de2
commit
054e91f5f8
@ -30,6 +30,8 @@ func ListMessage(channel models.Channel, take int, offset int) ([]models.Message
|
||||
Order("created_at DESC").
|
||||
Preload("Attachments").
|
||||
Preload("ReplyTo").
|
||||
Preload("ReplyTo.Sender").
|
||||
Preload("ReplyTo.Sender.Account").
|
||||
Preload("Sender").
|
||||
Preload("Sender.Account").
|
||||
Find(&messages).Error; err != nil {
|
||||
@ -47,6 +49,8 @@ func GetMessage(channel models.Channel, id uint) (models.Message, error) {
|
||||
ChannelID: channel.ID,
|
||||
}).
|
||||
Preload("ReplyTo").
|
||||
Preload("ReplyTo.Sender").
|
||||
Preload("ReplyTo.Sender.Account").
|
||||
Preload("Attachments").
|
||||
Preload("Sender").
|
||||
Preload("Sender.Account").
|
||||
@ -78,6 +82,10 @@ func NewMessage(message models.Message) (models.Message, error) {
|
||||
ChannelID: message.ChannelID,
|
||||
}).Preload("Account").Find(&members).Error; err == nil {
|
||||
for _, member := range members {
|
||||
if member.ID == message.Sender.ID {
|
||||
continue
|
||||
}
|
||||
|
||||
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.")
|
||||
|
Loading…
Reference in New Issue
Block a user