Join group on accepting activity center notification

This commit is contained in:
Andrea Maria Piana 2022-05-30 16:34:48 +01:00
parent 5df5d6b519
commit 09ba88c19d
3 changed files with 12 additions and 6 deletions

View File

@ -1 +1 @@
0.100.2
0.101.0

View File

@ -4,8 +4,8 @@ import (
"context"
"github.com/golang/protobuf/proto"
"github.com/pkg/errors"
"go.uber.org/zap"
"github.com/status-im/status-go/eth-node/types"
"github.com/status-im/status-go/protocol/common"
@ -100,6 +100,15 @@ func (m *Messenger) processActivityCenterNotifications(notifications []*Activity
}
chat.Active = true
if chat.PrivateGroupChat() {
// Send Joined message for backward compatibility
_, err := m.ConfirmJoiningGroup(context.Background(), chat.ID)
if err != nil {
m.logger.Error("failed to join group", zap.Error(err))
return nil, err
}
}
chats = append(chats, chat)
response.AddChat(chat)
}
@ -235,7 +244,6 @@ func (m *Messenger) ActivityCenterNotifications(cursor string, limit uint64) (*A
}
func (m *Messenger) handleActivityCenterRead(state *ReceivedMessageState, message protobuf.SyncActivityCenterRead) error {
m.logger.Info("HANDLING SYNC ACTIVITY CENTER READ")
resp, err := m.MarkActivityCenterNotificationsRead(context.TODO(), toHexBytes(message.Ids), false)
if err != nil {
@ -246,7 +254,6 @@ func (m *Messenger) handleActivityCenterRead(state *ReceivedMessageState, messag
}
func (m *Messenger) handleActivityCenterAccepted(state *ReceivedMessageState, message protobuf.SyncActivityCenterAccepted) error {
m.logger.Info("HANDLING SYNC ACTIVITY CENTER ACCEPTED")
resp, err := m.AcceptActivityCenterNotifications(context.TODO(), toHexBytes(message.Ids), false)
if err != nil {
@ -257,7 +264,6 @@ func (m *Messenger) handleActivityCenterAccepted(state *ReceivedMessageState, me
}
func (m *Messenger) handleActivityCenterDismissed(state *ReceivedMessageState, message protobuf.SyncActivityCenterDismissed) error {
m.logger.Info("HANDLING SYNC ACTIVITY CENTER DISMISS")
resp, err := m.DismissActivityCenterNotifications(context.TODO(), toHexBytes(message.Ids), false)
if err != nil {

View File

@ -519,7 +519,7 @@ func (s *MessengerSuite) TestSendPrivateGroup() {
s.Require().NotEqual(uint64(0), chat.Timestamp, "it sets the timestamp")
s.Require().Equal("0x"+hex.EncodeToString(crypto.FromECDSAPub(&s.privateKey.PublicKey)), outputMessage.From, "it sets the From field")
s.Require().True(outputMessage.Seen, "it marks the message as seen")
s.Require().Equal(outputMessage.OutgoingStatus, common.OutgoingStatusSent, "it marks the message as sent")
s.Require().Equal(outputMessage.OutgoingStatus, common.OutgoingStatusSending, "it marks the message as sending")
s.Require().NotEmpty(outputMessage.ID, "it sets the ID field")
s.Require().Equal(protobuf.MessageType_PRIVATE_GROUP, outputMessage.MessageType)
}