[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:
parent
b8209cbc7d
commit
141a3e2633
|
@ -1909,6 +1909,12 @@ func (s *MessengerCommunitiesSuite) TestRequestAccessAgain() {
|
||||||
if len(response.Communities()) == 0 {
|
if len(response.Communities()) == 0 {
|
||||||
return errors.New("community not received")
|
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
|
return nil
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -4347,11 +4347,17 @@ func (m *Messenger) handleRetrievedMessages(chatWithMessages map[transport.Filte
|
||||||
Type: ActivityCenterNotificationTypeCommunityKicked,
|
Type: ActivityCenterNotificationTypeCommunityKicked,
|
||||||
Timestamp: m.getTimesource().GetCurrentTime(),
|
Timestamp: m.getTimesource().GetCurrentTime(),
|
||||||
CommunityID: changes.Community.IDString(),
|
CommunityID: changes.Community.IDString(),
|
||||||
|
Read: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
err = m.addActivityCenterNotification(response, notification)
|
err = m.addActivityCenterNotification(response, notification)
|
||||||
if err != nil {
|
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
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -306,6 +306,7 @@ func (r *MessengerResponse) Merge(response *MessengerResponse) error {
|
||||||
r.AddVerificationRequests(response.VerificationRequests())
|
r.AddVerificationRequests(response.VerificationRequests())
|
||||||
r.AddTrustStatuses(response.trustStatus)
|
r.AddTrustStatuses(response.trustStatus)
|
||||||
r.AddActivityCenterNotifications(response.ActivityCenterNotifications())
|
r.AddActivityCenterNotifications(response.ActivityCenterNotifications())
|
||||||
|
r.SetActivityCenterState(response.ActivityCenterState())
|
||||||
r.AddEmojiReactions(response.EmojiReactions())
|
r.AddEmojiReactions(response.EmojiReactions())
|
||||||
r.AddInstallations(response.Installations)
|
r.AddInstallations(response.Installations)
|
||||||
r.AddSavedAddresses(response.SavedAddresses())
|
r.AddSavedAddresses(response.SavedAddresses())
|
||||||
|
|
Loading…
Reference in New Issue