diff --git a/background.html b/background.html
index 88f6a3045..dfc775876 100644
--- a/background.html
+++ b/background.html
@@ -102,7 +102,9 @@
{{/group}}
{{^group}}
-
{{ show-identity }}
+ {{ ^isMe }}
+ {{ show-identity }}
+ {{ /isMe }}
{{ end-session }}
{{/group}}
{{ destroy }}
diff --git a/js/models/conversations.js b/js/models/conversations.js
index 6fc0aab33..12a572468 100644
--- a/js/models/conversations.js
+++ b/js/models/conversations.js
@@ -56,6 +56,10 @@
this.on('destroy', this.revokeAvatarUrl);
},
+ isMe: function() {
+ return this.id === this.ourNumber;
+ },
+
updateVerified: function() {
function checkTrustStore(value) {
return Promise.resolve(value);
@@ -73,7 +77,7 @@
} else {
return this.fetchContacts().then(function() {
return Promise.all(this.contactCollection.map(function(contact) {
- if (contact.id !== this.ourNumber) {
+ if (!contact.isMe()) {
return contact.updateVerified();
}
}.bind(this)));
@@ -121,7 +125,7 @@
}
return this.contactCollection.every(function(contact) {
- if (contact.id === this.ourNumber) {
+ if (contact.isMe()) {
return true;
} else {
return contact.isVerified();
@@ -139,7 +143,7 @@
}
return this.contactCollection.any(function(contact) {
- if (contact.id === this.ourNumber) {
+ if (contact.isMe()) {
return false;
} else {
return contact.isUnverified();
@@ -152,7 +156,7 @@
return this.isUnverified() ? new Backbone.Collection([this]) : new Backbone.Collection();
} else {
return new Backbone.Collection(this.contactCollection.filter(function(contact) {
- if (contact.id === this.ourNumber) {
+ if (contact.isMe()) {
return false;
} else {
return contact.isUnverified();
@@ -174,7 +178,7 @@
}
return Promise.all(this.contactCollection.map(function(contact) {
- if (contact.id === this.ourNumber) {
+ if (contact.isMe()) {
return false;
} else {
return contact.isUntrusted();
@@ -199,7 +203,7 @@
}.bind(this));
} else {
return Promise.all(this.contactCollection.map(function(contact) {
- if (contact.id === this.ourNumber) {
+ if (contact.isMe()) {
return [false, contact];
} else {
return Promise.all([this.isUntrusted(), contact]);
diff --git a/js/views/conversation_view.js b/js/views/conversation_view.js
index 016233b3d..e39b196d2 100644
--- a/js/views/conversation_view.js
+++ b/js/views/conversation_view.js
@@ -82,6 +82,7 @@
render_attributes: function() {
return {
group: this.model.get('type') === 'group',
+ isMe: this.model.isMe(),
avatar: this.model.getAvatar(),
expireTimer: this.model.get('expireTimer'),
'show-members' : i18n('showMembers'),
diff --git a/test/index.html b/test/index.html
index 5a2ebaeb7..bc5cfd1b0 100644
--- a/test/index.html
+++ b/test/index.html
@@ -105,7 +105,9 @@
{{/group}}
{{^group}}
- {{ show-identity }}
+ {{ ^isMe }}
+ {{ show-identity }}
+ {{ /isMe }}
{{ end-session }}
{{/group}}
{{ destroy }}