fix(activity_center): Add remove activity center notifications array to message response (#3277)

This commit is contained in:
Boris Melnik 2023-03-16 21:41:53 +03:00 committed by GitHub
parent 4be978a2fe
commit 1453f5a0e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -107,11 +107,15 @@ func (s *MessengerDeleteMessageForEveryoneSuite) TestDeleteMessageForEveryone()
deleteMessageResponse, err := s.moderator.DeleteMessageAndSend(ctx, message.ID)
s.Require().NoError(err)
_, err = WaitOnMessengerResponse(s.bob, func(response *MessengerResponse) bool {
response, err = WaitOnMessengerResponse(s.bob, func(response *MessengerResponse) bool {
return len(response.RemovedMessages()) > 0
}, "removed messages not received")
s.Require().Equal(deleteMessageResponse.RemovedMessages()[0].DeletedBy, contactIDFromPublicKey(s.moderator.IdentityPublicKey()))
s.Require().NoError(err)
s.Require().Len(response.ActivityCenterNotifications(), 1)
s.Require().True(response.ActivityCenterNotifications()[0].Deleted)
message, err = s.bob.MessageByID(message.ID)
s.Require().NoError(err)
s.Require().True(message.Deleted)

View File

@ -1583,6 +1583,10 @@ func (m *Messenger) HandleDeleteMessage(state *ReceivedMessageState, deleteMessa
state.Response.AddRemovedMessage(&RemovedMessage{MessageID: messageID, ChatID: chat.ID, DeletedBy: deleteMessage.DeleteMessage.DeletedBy})
state.Response.AddChat(chat)
state.Response.AddNotification(DeletedMessageNotification(messageID, chat))
state.Response.AddActivityCenterNotification(&ActivityCenterNotification{
ID: types.FromHex(messageID),
Deleted: true,
})
return nil
}