chore: return chats after mark all notifications read (#4432)

This commit is contained in:
frank 2024-01-10 09:36:33 +08:00 committed by GitHub
parent e1b52f9eae
commit 5cb1972261
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 9 deletions

View File

@ -1 +1 @@
0.172.1
0.172.2

View File

@ -4260,22 +4260,22 @@ func (m *Messenger) MarkMessageAsUnread(chatID string, messageID string) (*Messe
// MarkMessagesSeen marks messages with `ids` as seen in the chat `chatID`.
// It returns the number of affected messages or error. If there is an error,
// the number of affected messages is always zero.
func (m *Messenger) markMessagesSeenImpl(chatID string, ids []string) (uint64, uint64, error) {
func (m *Messenger) markMessagesSeenImpl(chatID string, ids []string) (uint64, uint64, *Chat, error) {
count, countWithMentions, err := m.persistence.MarkMessagesSeen(chatID, ids)
if err != nil {
return 0, 0, err
return 0, 0, nil, err
}
chat, err := m.persistence.Chat(chatID)
if err != nil {
return 0, 0, err
return 0, 0, nil, err
}
m.allChats.Store(chatID, chat)
return count, countWithMentions, nil
return count, countWithMentions, chat, nil
}
// Deprecated: Use MarkMessagesRead instead
func (m *Messenger) MarkMessagesSeen(chatID string, ids []string) (uint64, uint64, []*ActivityCenterNotification, error) {
count, countWithMentions, err := m.markMessagesSeenImpl(chatID, ids)
count, countWithMentions, _, err := m.markMessagesSeenImpl(chatID, ids)
if err != nil {
return 0, 0, nil, err
}
@ -4301,7 +4301,7 @@ func (m *Messenger) MarkMessagesSeen(chatID string, ids []string) (uint64, uint6
}
func (m *Messenger) MarkMessagesRead(chatID string, ids []string) (*MessengerResponse, error) {
count, countWithMentions, err := m.markMessagesSeenImpl(chatID, ids)
count, countWithMentions, _, err := m.markMessagesSeenImpl(chatID, ids)
if err != nil {
return nil, err
}

View File

@ -163,11 +163,11 @@ func (m *Messenger) MarkActivityCenterNotificationsRead(ctx context.Context, ids
// Mark messages as seen
for chatID, messageIDs := range repliesAndMentions {
count, countWithMentions, err := m.markMessagesSeenImpl(chatID, messageIDs)
count, countWithMentions, chat, err := m.markMessagesSeenImpl(chatID, messageIDs)
if err != nil {
return nil, err
}
response.AddChat(chat)
response.AddSeenAndUnseenMessages(&SeenUnseenMessages{
ChatID: chatID,
Count: count,