mirror of
https://github.com/status-im/status-go.git
synced 2025-01-21 12:11:44 +00:00
fix: Move ActivityCenterNotificationTypeCommunityKicked to the right place (#3390)
This commit is contained in:
parent
06749717ea
commit
302437e32e
@ -996,6 +996,16 @@ func (s *MessengerCommunitiesSuite) TestRequestAccess() {
|
||||
|
||||
s.Require().Equal(requestToJoin1.ID, requestToJoin2.ID)
|
||||
|
||||
s.Require().Len(response.ActivityCenterNotifications(), 1)
|
||||
|
||||
notification = response.ActivityCenterNotifications()[0]
|
||||
s.Require().NotNil(notification)
|
||||
s.Require().Equal(notification.Type, ActivityCenterNotificationTypeCommunityMembershipRequest)
|
||||
s.Require().Equal(notification.MembershipStatus, ActivityCenterMembershipStatusPending)
|
||||
s.Require().Equal(notification.Read, false)
|
||||
s.Require().Equal(notification.Accepted, false)
|
||||
s.Require().Equal(notification.Dismissed, false)
|
||||
|
||||
// Accept request
|
||||
|
||||
acceptRequestToJoin := &requests.AcceptRequestToJoinCommunity{ID: requestToJoin1.ID}
|
||||
@ -1039,6 +1049,16 @@ func (s *MessengerCommunitiesSuite) TestRequestAccess() {
|
||||
s.Require().Len(response.RequestsToJoinCommunity, 1)
|
||||
s.Require().Equal(communities.RequestToJoinStateAccepted, response.RequestsToJoinCommunity[0].State)
|
||||
|
||||
s.Require().Len(response.ActivityCenterNotifications(), 1)
|
||||
|
||||
notification = response.ActivityCenterNotifications()[0]
|
||||
s.Require().NotNil(notification)
|
||||
s.Require().Equal(notification.Type, ActivityCenterNotificationTypeCommunityRequest)
|
||||
s.Require().Equal(notification.MembershipStatus, ActivityCenterMembershipStatusAccepted)
|
||||
s.Require().Equal(notification.Read, true)
|
||||
s.Require().Equal(notification.Accepted, false)
|
||||
s.Require().Equal(notification.Dismissed, false)
|
||||
|
||||
s.Require().Len(response.Communities(), 1)
|
||||
aliceCommunity := response.Communities()[0]
|
||||
|
||||
@ -1453,6 +1473,18 @@ func (s *MessengerCommunitiesSuite) TestRequestAccessAgain() {
|
||||
return nil
|
||||
})
|
||||
|
||||
// Check we got AC notification for Alice
|
||||
aliceNotifications, err := s.alice.ActivityCenterNotifications(ActivityCenterNotificationsRequest{
|
||||
Cursor: "",
|
||||
Limit: 10,
|
||||
ActivityTypes: []ActivityCenterType{ActivityCenterNotificationTypeCommunityKicked},
|
||||
ReadType: ActivityCenterQueryParamsReadUnread,
|
||||
},
|
||||
)
|
||||
s.Require().NoError(err)
|
||||
s.Require().Len(aliceNotifications.Notifications, 1)
|
||||
s.Require().Equal(community.IDString(), aliceNotifications.Notifications[0].CommunityID)
|
||||
|
||||
s.Require().NoError(err)
|
||||
s.Require().NotNil(response)
|
||||
|
||||
|
@ -3884,7 +3884,6 @@ func (m *Messenger) handleRetrievedMessages(chatWithMessages map[transport.Filte
|
||||
continue
|
||||
}
|
||||
case protobuf.RetractContactRequest:
|
||||
|
||||
logger.Debug("Handling RetractContactRequest")
|
||||
message := msg.ParsedMessage.Interface().(protobuf.RetractContactRequest)
|
||||
m.outputToCSV(msg.TransportMessage.Timestamp, msg.ID, senderID, filter.Topic, filter.ChatID, msg.Type, message)
|
||||
@ -4265,9 +4264,21 @@ func (m *Messenger) handleRetrievedMessages(chatWithMessages map[transport.Filte
|
||||
if err := messageState.Response.Merge(response); err != nil {
|
||||
logger.Error("cannot merge join community response", zap.Error(err))
|
||||
continue
|
||||
|
||||
}
|
||||
|
||||
// Activity Center notification
|
||||
notification := &ActivityCenterNotification{
|
||||
ID: types.FromHex(uuid.New().String()),
|
||||
Type: ActivityCenterNotificationTypeCommunityKicked,
|
||||
Timestamp: m.getTimesource().GetCurrentTime(),
|
||||
CommunityID: changes.Community.IDString(),
|
||||
}
|
||||
|
||||
err = m.addActivityCenterNotification(response, notification)
|
||||
if err != nil {
|
||||
m.logger.Error("failed to save notification", zap.Error(err))
|
||||
continue
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,6 @@ import (
|
||||
|
||||
"github.com/status-im/status-go/signal"
|
||||
|
||||
"github.com/pborman/uuid"
|
||||
"github.com/pkg/errors"
|
||||
"go.uber.org/zap"
|
||||
|
||||
@ -1449,20 +1448,6 @@ func (m *Messenger) HandleCommunityRequestToLeave(state *ReceivedMessageState, s
|
||||
state.Response.AddCommunity(response.Communities()[0])
|
||||
}
|
||||
|
||||
// Activity Center notification
|
||||
notification := &ActivityCenterNotification{
|
||||
ID: types.FromHex(uuid.NewRandom().String()),
|
||||
Type: ActivityCenterNotificationTypeCommunityKicked,
|
||||
Timestamp: m.getTimesource().GetCurrentTime(),
|
||||
CommunityID: string(requestToLeaveProto.CommunityId),
|
||||
}
|
||||
|
||||
err = m.addActivityCenterNotification(state.Response, notification)
|
||||
if err != nil {
|
||||
m.logger.Error("failed to save notification", zap.Error(err))
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user