From 1453f5a0e3a2481a893ed7a233f40137eec9e9a1 Mon Sep 17 00:00:00 2001 From: Boris Melnik Date: Thu, 16 Mar 2023 21:41:53 +0300 Subject: [PATCH] fix(activity_center): Add remove activity center notifications array to message response (#3277) --- protocol/messenger_delete_message_for_everyone_test.go | 6 +++++- protocol/messenger_handler.go | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/protocol/messenger_delete_message_for_everyone_test.go b/protocol/messenger_delete_message_for_everyone_test.go index eea1caf7c..fa2a6ab8a 100644 --- a/protocol/messenger_delete_message_for_everyone_test.go +++ b/protocol/messenger_delete_message_for_everyone_test.go @@ -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) diff --git a/protocol/messenger_handler.go b/protocol/messenger_handler.go index 52fd75c88..79298dfe6 100644 --- a/protocol/messenger_handler.go +++ b/protocol/messenger_handler.go @@ -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 }