Prevent access to Safety Number when talking to yourself
FREEBIE
This commit is contained in:
parent
c7e385eb38
commit
8d29cb9830
4 changed files with 17 additions and 8 deletions
|
@ -102,7 +102,9 @@
|
||||||
<!-- <li class='leave-group'>Leave group</li> -->
|
<!-- <li class='leave-group'>Leave group</li> -->
|
||||||
{{/group}}
|
{{/group}}
|
||||||
{{^group}}
|
{{^group}}
|
||||||
<li class='show-identity'>{{ show-identity }}</li>
|
{{ ^isMe }}
|
||||||
|
<li class='show-identity'>{{ show-identity }}</li>
|
||||||
|
{{ /isMe }}
|
||||||
<li class='end-session'>{{ end-session }}</li>
|
<li class='end-session'>{{ end-session }}</li>
|
||||||
{{/group}}
|
{{/group}}
|
||||||
<li class='destroy'>{{ destroy }}</li>
|
<li class='destroy'>{{ destroy }}</li>
|
||||||
|
|
|
@ -56,6 +56,10 @@
|
||||||
this.on('destroy', this.revokeAvatarUrl);
|
this.on('destroy', this.revokeAvatarUrl);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
isMe: function() {
|
||||||
|
return this.id === this.ourNumber;
|
||||||
|
},
|
||||||
|
|
||||||
updateVerified: function() {
|
updateVerified: function() {
|
||||||
function checkTrustStore(value) {
|
function checkTrustStore(value) {
|
||||||
return Promise.resolve(value);
|
return Promise.resolve(value);
|
||||||
|
@ -73,7 +77,7 @@
|
||||||
} else {
|
} else {
|
||||||
return this.fetchContacts().then(function() {
|
return this.fetchContacts().then(function() {
|
||||||
return Promise.all(this.contactCollection.map(function(contact) {
|
return Promise.all(this.contactCollection.map(function(contact) {
|
||||||
if (contact.id !== this.ourNumber) {
|
if (!contact.isMe()) {
|
||||||
return contact.updateVerified();
|
return contact.updateVerified();
|
||||||
}
|
}
|
||||||
}.bind(this)));
|
}.bind(this)));
|
||||||
|
@ -121,7 +125,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.contactCollection.every(function(contact) {
|
return this.contactCollection.every(function(contact) {
|
||||||
if (contact.id === this.ourNumber) {
|
if (contact.isMe()) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return contact.isVerified();
|
return contact.isVerified();
|
||||||
|
@ -139,7 +143,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.contactCollection.any(function(contact) {
|
return this.contactCollection.any(function(contact) {
|
||||||
if (contact.id === this.ourNumber) {
|
if (contact.isMe()) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return contact.isUnverified();
|
return contact.isUnverified();
|
||||||
|
@ -152,7 +156,7 @@
|
||||||
return this.isUnverified() ? new Backbone.Collection([this]) : new Backbone.Collection();
|
return this.isUnverified() ? new Backbone.Collection([this]) : new Backbone.Collection();
|
||||||
} else {
|
} else {
|
||||||
return new Backbone.Collection(this.contactCollection.filter(function(contact) {
|
return new Backbone.Collection(this.contactCollection.filter(function(contact) {
|
||||||
if (contact.id === this.ourNumber) {
|
if (contact.isMe()) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return contact.isUnverified();
|
return contact.isUnverified();
|
||||||
|
@ -174,7 +178,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
return Promise.all(this.contactCollection.map(function(contact) {
|
return Promise.all(this.contactCollection.map(function(contact) {
|
||||||
if (contact.id === this.ourNumber) {
|
if (contact.isMe()) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return contact.isUntrusted();
|
return contact.isUntrusted();
|
||||||
|
@ -199,7 +203,7 @@
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
} else {
|
} else {
|
||||||
return Promise.all(this.contactCollection.map(function(contact) {
|
return Promise.all(this.contactCollection.map(function(contact) {
|
||||||
if (contact.id === this.ourNumber) {
|
if (contact.isMe()) {
|
||||||
return [false, contact];
|
return [false, contact];
|
||||||
} else {
|
} else {
|
||||||
return Promise.all([this.isUntrusted(), contact]);
|
return Promise.all([this.isUntrusted(), contact]);
|
||||||
|
|
|
@ -82,6 +82,7 @@
|
||||||
render_attributes: function() {
|
render_attributes: function() {
|
||||||
return {
|
return {
|
||||||
group: this.model.get('type') === 'group',
|
group: this.model.get('type') === 'group',
|
||||||
|
isMe: this.model.isMe(),
|
||||||
avatar: this.model.getAvatar(),
|
avatar: this.model.getAvatar(),
|
||||||
expireTimer: this.model.get('expireTimer'),
|
expireTimer: this.model.get('expireTimer'),
|
||||||
'show-members' : i18n('showMembers'),
|
'show-members' : i18n('showMembers'),
|
||||||
|
|
|
@ -105,7 +105,9 @@
|
||||||
<!-- <li class='leave-group'>Leave group</li> -->
|
<!-- <li class='leave-group'>Leave group</li> -->
|
||||||
{{/group}}
|
{{/group}}
|
||||||
{{^group}}
|
{{^group}}
|
||||||
<li class='show-identity'>{{ show-identity }}</li>
|
{{ ^isMe }}
|
||||||
|
<li class='show-identity'>{{ show-identity }}</li>
|
||||||
|
{{ /isMe }}
|
||||||
<li class='end-session'>{{ end-session }}</li>
|
<li class='end-session'>{{ end-session }}</li>
|
||||||
{{/group}}
|
{{/group}}
|
||||||
<li class='destroy'>{{ destroy }}</li>
|
<li class='destroy'>{{ destroy }}</li>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue