fix(Messenger): Count SystemMessagePinnedMessage as unviewed (#3449)
This commit is contained in:
parent
46bac20260
commit
44ded4dd64
|
@ -751,6 +751,7 @@ func (m *Messenger) handlePinMessage(pinner *Contact, whisperTimestamp uint64, r
|
||||||
From: pinner.ID,
|
From: pinner.ID,
|
||||||
}
|
}
|
||||||
response.AddMessage(message)
|
response.AddMessage(message)
|
||||||
|
chat.UnviewedMessagesCount++
|
||||||
}
|
}
|
||||||
|
|
||||||
if chat.LastClockValue < message.Clock {
|
if chat.LastClockValue < message.Clock {
|
||||||
|
|
|
@ -114,6 +114,7 @@ func (s *MessengerPinMessageSuite) TestPinMessageOutOfOrder() {
|
||||||
)
|
)
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
s.Require().Len(response.Chats(), 1)
|
s.Require().Len(response.Chats(), 1)
|
||||||
|
s.Require().Equal(response.Chats()[0].UnviewedMessagesCount, uint(1))
|
||||||
|
|
||||||
// Unpin with higher clock
|
// Unpin with higher clock
|
||||||
|
|
||||||
|
@ -136,6 +137,8 @@ func (s *MessengerPinMessageSuite) TestPinMessageOutOfOrder() {
|
||||||
|
|
||||||
s.Require().Len(handlePinMessageResponse.PinMessages(), 1)
|
s.Require().Len(handlePinMessageResponse.PinMessages(), 1)
|
||||||
s.Require().False(handlePinMessageResponse.PinMessages()[0].Pinned)
|
s.Require().False(handlePinMessageResponse.PinMessages()[0].Pinned)
|
||||||
|
s.Require().Len(handlePinMessageResponse.Chats(), 1)
|
||||||
|
s.Require().Equal(handlePinMessageResponse.Chats()[0].UnviewedMessagesCount, uint(0))
|
||||||
|
|
||||||
// Pin with lower clock in response
|
// Pin with lower clock in response
|
||||||
|
|
||||||
|
@ -157,6 +160,8 @@ func (s *MessengerPinMessageSuite) TestPinMessageOutOfOrder() {
|
||||||
|
|
||||||
s.Require().Len(handlePinMessageResponse.PinMessages(), 1)
|
s.Require().Len(handlePinMessageResponse.PinMessages(), 1)
|
||||||
s.Require().False(handlePinMessageResponse.PinMessages()[0].Pinned)
|
s.Require().False(handlePinMessageResponse.PinMessages()[0].Pinned)
|
||||||
|
s.Require().Len(handlePinMessageResponse.Chats(), 1)
|
||||||
|
s.Require().Equal(handlePinMessageResponse.Chats()[0].UnviewedMessagesCount, uint(0))
|
||||||
|
|
||||||
// Pin with lower clock not in response
|
// Pin with lower clock not in response
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue