Improve identity key conflict ux
Clicking on a key conflict message opens the message detail view, which displays the contact(s) in this conversation. If the message contains a key conflict with any of these contacts, a button is displayed which attempts to resolve that conflict and any other conflicts in the conversation that are related to that contact.
This commit is contained in:
parent
857eee5003
commit
897d391817
11 changed files with 415 additions and 81 deletions
|
@ -221,33 +221,24 @@
|
|||
return this.avatarUrl || '/images/default.png';
|
||||
},
|
||||
|
||||
resolveConflicts: function() {
|
||||
if (!this.isPrivate()) {
|
||||
throw "Can't call resolveConflicts on non-private conversation";
|
||||
resolveConflicts: function(number) {
|
||||
if (this.isPrivate()) {
|
||||
number = this.id;
|
||||
} else if (!_.find(this.get('members'), number)) {
|
||||
throw 'Tried to resolve conflicts for a unknown group member';
|
||||
}
|
||||
|
||||
if (!this.messageCollection.find(function(m) { return m.getKeyConflict(); })) {
|
||||
throw "No conflicts to resolve";
|
||||
if (!this.messageCollection.hasKeyConflicts()) {
|
||||
throw 'No conflicts to resolve';
|
||||
}
|
||||
|
||||
textsecure.storage.devices.removeIdentityKeyForNumber(this.get('id'));
|
||||
textsecure.storage.devices.removeIdentityKeyForNumber(number);
|
||||
this.messageCollection.each(function(message) {
|
||||
var conflict = message.getKeyConflict();
|
||||
if (conflict) {
|
||||
new textsecure.ReplayableError(conflict).replay().
|
||||
then(function(pushMessageContent) {
|
||||
message.save('errors', []);
|
||||
if (message.isIncoming()) {
|
||||
extension.trigger('message:decrypted', {
|
||||
message_id: message.id,
|
||||
data: pushMessageContent
|
||||
});
|
||||
}
|
||||
});
|
||||
if (message.hasKeyConflict(number)) {
|
||||
message.resolveConflict(number);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
Whisper.ConversationCollection = Backbone.Collection.extend({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue