[Fix] Added Community Kicked notification to response (#3427)

* [Fix] Added Community Kicked notification to response

* Added unit test and updated response merge method

* Update VERSION
This commit is contained in:
Mohamed Javid 2023-04-26 22:00:54 +08:00 committed by GitHub
parent b8209cbc7d
commit 141a3e2633
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 2 deletions

View File

@ -1 +1 @@
0.148.0
0.148.1

View File

@ -1909,6 +1909,12 @@ func (s *MessengerCommunitiesSuite) TestRequestAccessAgain() {
if len(response.Communities()) == 0 {
return errors.New("community not received")
}
if len(response.ActivityCenterNotifications()) == 0 {
return errors.New("activity center notification not received")
}
if response.ActivityCenterState().HasSeen {
return errors.New("activity center seen state is incorrect")
}
return nil
})

View File

@ -4347,11 +4347,17 @@ func (m *Messenger) handleRetrievedMessages(chatWithMessages map[transport.Filte
Type: ActivityCenterNotificationTypeCommunityKicked,
Timestamp: m.getTimesource().GetCurrentTime(),
CommunityID: changes.Community.IDString(),
Read: false,
}
err = m.addActivityCenterNotification(response, notification)
if err != nil {
m.logger.Error("failed to save notification", zap.Error(err))
logger.Error("failed to save notification", zap.Error(err))
continue
}
if err := messageState.Response.Merge(response); err != nil {
logger.Error("cannot merge notification response", zap.Error(err))
continue
}
}

View File

@ -306,6 +306,7 @@ func (r *MessengerResponse) Merge(response *MessengerResponse) error {
r.AddVerificationRequests(response.VerificationRequests())
r.AddTrustStatuses(response.trustStatus)
r.AddActivityCenterNotifications(response.ActivityCenterNotifications())
r.SetActivityCenterState(response.ActivityCenterState())
r.AddEmojiReactions(response.EmojiReactions())
r.AddInstallations(response.Installations)
r.AddSavedAddresses(response.SavedAddresses())