Differentiate between local and remote trust decisions

FREEBIE
pull/749/head
Scott Nonnenberg 8 years ago
parent 20f4d48991
commit 1e8ae774a2

@ -45,7 +45,27 @@
}, },
"youMarkedAsNotVerified": { "youMarkedAsNotVerified": {
"message": "You marked $name$ as not verified.", "message": "You marked $name$ as not verified.",
"description": "Shown in the conversation history when the user marks a contact as verified, whether on the safety number screen or by dismissing a banner or dialog.", "description": "Shown in the conversation history when the user marks a contact as not verified, whether on the safety number screen or by dismissing a banner or dialog.",
"placeholders": {
"name": {
"content": "$1",
"example": "Bob"
}
}
},
"youMarkedAsVerifiedOtherDevice": {
"message": "You marked $name$ as verified on another device.",
"description": "Shown in the conversation history when we discover that the user marked a contact as verified on another device.",
"placeholders": {
"name": {
"content": "$1",
"example": "Bob"
}
}
},
"youMarkedAsNotVerifiedOtherDevice": {
"message": "You marked $name$ as not verified on anther device.",
"description": "Shown in the conversation history when we discover that the user marked a contact as not verified on another device.",
"placeholders": { "placeholders": {
"name": { "name": {
"content": "$1", "content": "$1",

@ -101,7 +101,7 @@
return promise.then(function() { return promise.then(function() {
return this.save({verified: DEFAULT}); return this.save({verified: DEFAULT});
}.bind(this)).then(function() { }.bind(this)).then(function() {
this.addVerifiedChange(this.id, false); this.addVerifiedChange(this.id, false, {local: !options.viaSyncMessage});
if (!options.viaSyncMessage) { if (!options.viaSyncMessage) {
this.sendVerifySyncMessage(this.id, DEFAULT); this.sendVerifySyncMessage(this.id, DEFAULT);
} }
@ -134,7 +134,7 @@
return promise.then(function() { return promise.then(function() {
return this.save({verified: VERIFIED}); return this.save({verified: VERIFIED});
}.bind(this)).then(function() { }.bind(this)).then(function() {
this.addVerifiedChange(this.id, true); this.addVerifiedChange(this.id, true, {local: !options.viaSyncMessage});
if (!options.viaSyncMessage) { if (!options.viaSyncMessage) {
this.sendVerifySyncMessage(this.id, VERIFIED); this.sendVerifySyncMessage(this.id, VERIFIED);
} }
@ -270,7 +270,10 @@
}); });
message.save().then(this.trigger.bind(this,'newmessage', message)); message.save().then(this.trigger.bind(this,'newmessage', message));
}, },
addVerifiedChange: function(id, verified) { addVerifiedChange: function(id, verified, options) {
options = options || {};
_.defaults(options, {local: true});
console.log('adding verified change advisory for', this.id, id, this.get('timestamp')); console.log('adding verified change advisory for', this.id, id, this.get('timestamp'));
var timestamp = Date.now(); var timestamp = Date.now();
var message = new Whisper.Message({ var message = new Whisper.Message({
@ -280,7 +283,8 @@
sent_at : this.get('timestamp'), sent_at : this.get('timestamp'),
received_at : timestamp, received_at : timestamp,
verifiedChanged : id, verifiedChanged : id,
verified : verified verified : verified,
local : options.local
}); });
message.save().then(this.trigger.bind(this,'newmessage', message)); message.save().then(this.trigger.bind(this,'newmessage', message));

@ -113,16 +113,29 @@
'click .content': 'showIdentity' 'click .content': 'showIdentity'
}, },
render_attributes: function() { render_attributes: function() {
var key;
if (this.model.get('verified')) { if (this.model.get('verified')) {
if (this.model.get('local')) {
key = 'youMarkedAsVerified';
} else {
key = 'youMarkedAsVerifiedOtherDevice';
}
return { return {
icon: 'verified', icon: 'verified',
content: i18n('youMarkedAsVerified', this.conversation.getTitle()) content: i18n(key, this.conversation.getTitle())
}; };
} }
if (this.model.get('local')) {
key = 'youMarkedAsNotVerified';
} else {
key = 'youMarkedAsNotVerifiedOtherDevice';
}
return { return {
icon: 'shield', icon: 'shield',
content: i18n('youMarkedAsNotVerified', this.conversation.getTitle()) content: i18n(key, this.conversation.getTitle())
}; };
}, },
showIdentity: function() { showIdentity: function() {

Loading…
Cancel
Save