Skip to content

Commit

Permalink
fix(backup)_: dont generate a CR if the synced contact is mutual
Browse files Browse the repository at this point in the history
Fixes status-im/status-desktop#15849

The problem was that we generated a "fake" contact request for all synced contacts.
While it's true that even mutual contacts have a contact request, we don't need it anymore once mutual and since we don't sync messages, we had to generate it with a default message and that message looked very out of place after a recovery.
  • Loading branch information
jrainville committed Dec 9, 2024
1 parent 4ccb08f commit 029ea03
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions protocol/messenger_contacts.go
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,7 @@ func (m *Messenger) generateContactRequest(clock uint64, timestamp uint64, conta
contactRequest := common.NewMessage()
contactRequest.ChatId = contact.ID
contactRequest.WhisperTimestamp = timestamp
contactRequest.Timestamp = timestamp
contactRequest.Seen = true
contactRequest.Text = text
if outgoing {
Expand Down
4 changes: 4 additions & 0 deletions protocol/messenger_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,10 @@ func (m *Messenger) handleCommandMessage(state *ReceivedMessageState, message *c
}

func (m *Messenger) syncContactRequestForInstallationContact(contact *Contact, state *ReceivedMessageState, chat *Chat, outgoing bool) error {
if contact.mutual() {
// We only need to generate a contact request if we are not mutual
return nil
}

if chat == nil {
return fmt.Errorf("no chat restored during the contact synchronisation, contact.ID = %s", contact.ID)
Expand Down

0 comments on commit 029ea03

Please sign in to comment.