From b49e57337a4b026db61237291d581f9a21a8c2fe Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Sun, 31 Mar 2024 20:48:51 +0800 Subject: [PATCH] :bug: Bug fixes of deletion --- pkg/services/messages.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pkg/services/messages.go b/pkg/services/messages.go index 861713f..d81134f 100644 --- a/pkg/services/messages.go +++ b/pkg/services/messages.go @@ -117,19 +117,20 @@ func EditMessage(message models.Message) (models.Message, error) { } func DeleteMessage(message models.Message) (models.Message, error) { + prev, _ := GetMessage(models.Channel{ + BaseModel: models.BaseModel{ID: message.Channel.ID}, + }, message.ID) + var members []models.ChannelMember if err := database.C.Delete(&message).Error; err != nil { return message, err } else if err = database.C.Where(models.ChannelMember{ ChannelID: message.ChannelID, }).Find(&members).Error; err == nil { - message, _ = GetMessage(models.Channel{ - BaseModel: models.BaseModel{ID: message.Channel.ID}, - }, message.ID) for _, member := range members { PushCommand(member.AccountID, models.UnifiedCommand{ Action: "messages.burnt", - Payload: message, + Payload: prev, }) } }