🐛 Fix message attachment didn't marked

This commit is contained in:
LittleSheep 2025-03-11 13:09:37 +08:00
parent 7294aa3e43
commit 9014f59a2c

View File

@ -87,6 +87,13 @@ func NewEvent(event models.Event) (models.Event, error) {
return event, nil
}
if val, ok := event.Body["attachments"].([]string); ok && len(val) > 0 {
filekit.CountAttachmentUsage(gap.Nx, &proto.UpdateUsageRequest{
Rid: val,
Delta: 1,
})
}
event, err := GetEvent(event.ChannelID, event.ID)
if err != nil {
log.Error().Err(err).Msg("Failed to fetch event, the notifying of new event was terminated...")
@ -117,12 +124,6 @@ func NewEvent(event models.Event) (models.Event, error) {
go NotifyMessageEvent(members, event)
}
if val, ok := event.Body["attachments"].([]string); ok && len(val) > 0 {
filekit.CountAttachmentUsage(gap.Nx, &proto.UpdateUsageRequest{
Rid: val,
})
}
return event, nil
}