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

Link previews and shared URLs doesn't contain data for self contact link #4154

Closed
igor-sirotin opened this issue Oct 13, 2023 · 1 comment · Fixed by #4169
Closed

Link previews and shared URLs doesn't contain data for self contact link #4154

igor-sirotin opened this issue Oct 13, 2023 · 1 comment · Fixed by #4169
Assignees
Labels
E:Bug MVP E:Desktop New Share URL Format Implementation of the new share URL link format and other deep link associated issues E:New Unfurling API Implementation of the new unfurling API for all links

Comments

@igor-sirotin
Copy link
Collaborator

igor-sirotin commented Oct 13, 2023

Problem

When calling a ShareUserURLWithData or StatusUnfurler.buildContactData with self public key, the result won't contain any data like DisplayName, Description, thumbnail.

Implementation

In both cases:

... the contact is requested with messenger.allContacts.Load, which has custom handling for self-requests:

func (cm *contactMap) Load(contactID string) (*Contact, bool) {
if contactID == cm.me.ID {
cm.logger.Warn("contacts map: loading own identity", zap.String("contactID", contactID))
return cm.me, true
}
contact, ok := cm.sm.Load(contactID)
if contact == nil {
return nil, ok
}
return contact.(*Contact), ok
}

The problem is that contactMap.me is created with no properties and is never updated.

I think there might be more affected places.

Notes

The thing is that yourself is not a contact. The original change (#3627) for ContactsMap still makes sense. We should avoid storing ourselves as a contact.

There're 2 ways out of this:

  1. Keep ContactsMap as is and update messenger.GetContactByID so that it checks if self-request if made, build and return a valid contact from there.
  2. Keep ContactsMap up-to-date. This will require updating it on each change like SetDisplayName, SetBio, etc.

I tend to go with option 1.

@igor-sirotin igor-sirotin added E:Bug MVP E:New Unfurling API Implementation of the new unfurling API for all links E:Desktop New Share URL Format Implementation of the new share URL link format and other deep link associated issues labels Oct 13, 2023
@igor-sirotin igor-sirotin self-assigned this Oct 13, 2023
@igor-sirotin
Copy link
Collaborator Author

Related: #3719

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E:Bug MVP E:Desktop New Share URL Format Implementation of the new share URL link format and other deep link associated issues E:New Unfurling API Implementation of the new unfurling API for all links
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant