Revert "Allow receiving old messages after rejoining a pubchat"

This reverts commit fa136ebaa7.
This commit is contained in:
Roman Volosovskyi 2020-11-06 15:47:02 +02:00
parent 40e2fc7526
commit d20cf2583f
No known key found for this signature in database
GPG Key ID: 0238A4B5ECEE70DE
3 changed files with 3 additions and 32 deletions

View File

@ -1 +1 @@
0.63.5
0.63.6

View File

@ -355,7 +355,7 @@ func (m *MessageHandler) HandleChatMessage(state *ReceivedMessageState) error {
}
// If deleted-at is greater, ignore message
if chat.DeletedAtClockValue >= receivedMessage.Clock && !chat.Public() {
if chat.DeletedAtClockValue >= receivedMessage.Clock {
return nil
}

View File

@ -566,35 +566,6 @@ func (s *MessengerSuite) TestRetrieveTheirPublic() {
}
func (s *MessengerSuite) TestDeletedAtClockValue() {
theirMessenger := s.newMessenger(s.shh)
s.Require().NoError(theirMessenger.Start())
theirChat := CreateOneToOneChat("XXX", &s.privateKey.PublicKey, s.m.transport)
err := theirMessenger.SaveChat(&theirChat)
s.Require().NoError(err)
ourChat := CreateOneToOneChat("our-chat", &theirMessenger.identity.PublicKey, s.m.transport)
ourChat.UnviewedMessagesCount = 1
s.Require().NoError(err)
inputMessage := buildTestMessage(theirChat)
sendResponse, err := theirMessenger.SendChatMessage(context.Background(), inputMessage)
s.NoError(err)
s.Require().Len(sendResponse.Messages, 1)
ourChat.DeletedAtClockValue = sendResponse.Messages[0].Clock
err = s.m.SaveChat(&ourChat)
s.NoError(err)
// Wait for the message to reach its destination
time.Sleep(100 * time.Millisecond)
response, err := s.m.RetrieveAll()
s.Require().NoError(err)
s.Require().Len(response.Messages, 0)
s.Require().NoError(theirMessenger.Shutdown())
}
func (s *MessengerSuite) TestDeletedAtClockValuePubChat() {
theirMessenger := s.newMessenger(s.shh)
s.Require().NoError(theirMessenger.Start())
theirChat := CreatePublicChat("status", s.m.transport)
@ -621,7 +592,7 @@ func (s *MessengerSuite) TestDeletedAtClockValuePubChat() {
time.Sleep(100 * time.Millisecond)
response, err := s.m.RetrieveAll()
s.Require().NoError(err)
s.Require().Len(response.Messages, 1)
s.Require().Len(response.Messages, 0)
s.Require().NoError(theirMessenger.Shutdown())
}