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

A user can now add himself as a contact #1826

Merged
merged 1 commit into from Jan 13, 2020

Conversation

ChaosKid42
Copy link
Contributor

This is a very much simplified version of #1634.
It does not do anything about the subscription of the self contact and also does not show the correct user status (online/away etc). It is however sufficient to safe your own contact to the roster and use it for whatever you want to do with it (might e.g. be useful to send data such as images from your computer to your smartphone).
The subscription of the self contact is always shown as "both" regardless of what is actually saved in the roster. This is of course not entirely correct but might nevertheless be acceptable taking into account that this solution only needs minimum changes to the code.

@ChaosKid42 ChaosKid42 force-pushed the self_contact branch 2 times, most recently from b89e430 to cec4dac Compare January 6, 2020 11:47

const contact = this.get(jid);
const subscription = item.getAttribute("subscription");
const subscription = this.isSelf(jid) ? 'both' : item.getAttribute("subscription");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels too hacky. What happens when you just remove line 658, without making this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because of subscription === null the roster item won't be shown.
I updated the PR to make it less hacky: Now the case of a roster item belonging to yourself is handled in rosterview.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks better thanks.

@ChaosKid42 ChaosKid42 force-pushed the self_contact branch 4 times, most recently from 89b29fd to f91b38a Compare January 12, 2020 16:01
@jcbrand
Copy link
Member

jcbrand commented Jan 13, 2020

@ChaosKid42 Please resolve the conflicts, then I'll merge.

@ChaosKid42
Copy link
Contributor Author

@jcbrand Resolved the conflicts.

@jcbrand jcbrand merged commit 40726e0 into conversejs:master Jan 13, 2020
@ChaosKid42 ChaosKid42 deleted the self_contact branch January 13, 2020 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants