Merge pull request #11 from sachaaaaa/key_exchange_status

Change keysPending flag to keyExchangeCompleted in conversation model
pull/14/head
sachaaaaa 7 years ago committed by GitHub
commit b432700fe8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -76,7 +76,7 @@
return { return {
unreadCount: 0, unreadCount: 0,
verified: textsecure.storage.protocol.VerifiedStatus.DEFAULT, verified: textsecure.storage.protocol.VerifiedStatus.DEFAULT,
keysPending: true keyExchangeCompleted: false,
}; };
}, },
@ -398,29 +398,27 @@
return contact.isVerified(); return contact.isVerified();
}); });
}, },
isKeysPending() { isKeyExchangeCompleted() {
if (this.isPrivate()) { if (!this.isPrivate()) {
if (this.isMe()) { throw new Error(
return false; 'isKeyExchangeCompleted not implemented for groups'
} );
const keysPending = this.get('keysPending');
if (keysPending === undefined) {
keysPending = true;
}
return keysPending;
} }
throw new Error( if (this.isMe()) {
'isKeysPending not implemented for groups' return true;
); }
return this.get('keyExchangeCompleted') || false;
}, },
setKeysPending(keysPending) { setKeyExchangeCompleted(completed) {
if (typeof keysPending !== 'boolean') { if (typeof completed !== 'boolean') {
throw new Error( throw new Error(
'setKeysPending expects a boolean' 'setKeyExchangeCompleted expects a bool'
); );
} }
this.set({ keysPending });
this.set({ keyExchangeCompleted: completed });
}, },
isUnverified() { isUnverified() {
if (this.isPrivate()) { if (this.isPrivate()) {

@ -160,7 +160,7 @@
color: this.model.getColor(), color: this.model.getColor(),
avatarPath, avatarPath,
isVerified: this.model.isVerified(), isVerified: this.model.isVerified(),
isKeysPending: this.model.isKeysPending(), isKeysPending: this.model.isKeyExchangeCompleted() == false,
isMe: this.model.isMe(), isMe: this.model.isMe(),
isGroup: !this.model.isPrivate(), isGroup: !this.model.isPrivate(),
expirationSettingName, expirationSettingName,

Loading…
Cancel
Save