Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix syncing blocked contacts #3799

Merged
merged 7 commits into from
Aug 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.162.14
0.163.1
8 changes: 4 additions & 4 deletions protocol/contact.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ func (c *Contact) DismissContactRequest(clock uint64) ContactRequestProcessingRe

// Remote actions

func (c *Contact) contactRequestRetracted(clock uint64, syncing bool, r ContactRequestProcessingResponse) ContactRequestProcessingResponse {
func (c *Contact) contactRequestRetracted(clock uint64, fromSyncing bool, r ContactRequestProcessingResponse) ContactRequestProcessingResponse {
if clock <= c.ContactRequestRemoteClock {
return r
}
Expand All @@ -298,7 +298,7 @@ func (c *Contact) contactRequestRetracted(clock uint64, syncing bool, r ContactR
// the side it was sent from. The only exception is when the contact
// request has been explicitly dismissed, in which case we don't
// change state
if c.ContactRequestLocalState != ContactRequestStateDismissed && !syncing {
if c.ContactRequestLocalState != ContactRequestStateDismissed && !fromSyncing {
c.ContactRequestLocalClock = clock
c.ContactRequestLocalState = ContactRequestStateNone
}
Expand All @@ -308,8 +308,8 @@ func (c *Contact) contactRequestRetracted(clock uint64, syncing bool, r ContactR
return r
}

func (c *Contact) ContactRequestRetracted(clock uint64, syncing bool) ContactRequestProcessingResponse {
return c.contactRequestRetracted(clock, syncing, ContactRequestProcessingResponse{})
func (c *Contact) ContactRequestRetracted(clock uint64, fromSyncing bool) ContactRequestProcessingResponse {
return c.contactRequestRetracted(clock, fromSyncing, ContactRequestProcessingResponse{})
}

func (c *Contact) contactRequestReceived(clock uint64, r ContactRequestProcessingResponse) ContactRequestProcessingResponse {
Expand Down
8 changes: 8 additions & 0 deletions protocol/messenger.go
Original file line number Diff line number Diff line change
Expand Up @@ -3554,8 +3554,16 @@ func (m *Messenger) handleRetrievedMessages(chatWithMessages map[transport.Filte
}

senderID := contactIDFromPublicKey(publicKey)
ownID := contactIDFromPublicKey(m.IdentityPublicKey())
m.logger.Info("processing message", zap.Any("type", msg.Type), zap.String("senderID", senderID))

if senderID == ownID {
MishkaRogachev marked this conversation as resolved.
Show resolved Hide resolved
// Skip own messages of certain types
if msg.Type == protobuf.ApplicationMetadataMessage_CONTACT_CODE_ADVERTISEMENT {
continue
}
}

contact, contactFound := messageState.AllContacts.Load(senderID)

if _, ok := m.requestedContacts[senderID]; !ok {
Expand Down
2 changes: 1 addition & 1 deletion protocol/messenger_backup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ func (s *MessengerBackupSuite) TestBackupBlockedContacts() {
actualContacts := bob2.AddedContacts()
s.Require().Equal(actualContacts[0].ID, contactID1)

_, err = bob1.BlockContact(contactID1)
_, err = bob1.BlockContact(contactID1, false)
s.Require().NoError(err)

// Backup
Expand Down
Loading