-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Remove unregistered group members #1052
Remove unregistered group members #1052
Conversation
js/models/conversations.js
Outdated
}); | ||
var members = this.get('members'); | ||
members.splice(members.indexOf(source), 1); | ||
this.set({members: members}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a way to tell the model to just update itself from textsecure.storage.groups instead of doing this? comments appreciated!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
textsecure.storage.groups should eventually be dropped so we only have one source of truth for group membership.
If you want to be more concise you can use underscore:
this.set({
members: _.without(this.get('members'), source)
});
Looks like I need to test this some more. |
Okay, this works correctly in my tests now. Reopening. |
js/models/messages.js
Outdated
@@ -221,7 +221,9 @@ | |||
|
|||
if (conversation.get('type') === 'group') { | |||
errors.forEach(function(e) { | |||
if (e.name === 'UnregisteredUserError') { | |||
if (e.name === 'UnregisteredUserError' || | |||
(e.name === 'HTTPError' && e.code === 404)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps getKeysForNumber() should just throw UnregisteredUserError in this case?
js/models/conversations.js
Outdated
}); | ||
var members = this.get('members'); | ||
members.splice(members.indexOf(source), 1); | ||
this.set({members: members}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
textsecure.storage.groups should eventually be dropped so we only have one source of truth for group membership.
If you want to be more concise you can use underscore:
this.set({
members: _.without(this.get('members'), source)
});
js/models/messages.js
Outdated
} else { | ||
this.saveErrors(result.errors); | ||
errors = result.errors; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This creates a slight change in the order of operations since L215-218 now execute before saveErrors instead of after. Not sure if it matters, but might be best to avoid any unneeded change in behavior.
ee4e673
to
cfa86df
Compare
All done, thanks for the feedback! |
Locally remove unregistered users from group membership lists. Fixes signalapp#989 Related to signalapp/Signal-Android#6175 Closes signalapp#1052 // FREEBIE
This reverts commit fc6ed2a72405765484c044a257b180c9fe83bc7b.
cfa86df
to
82cd482
Compare
First time contributor checklist
Contributor checklist
FREEBIE
in my Git commit messagesDescription
Locally remove unregistered 🦆 🐔 🐝 from group membership lists.
Fixes #989
Related to signalapp/Signal-Android#6175
// FREEBIE