Change keysPending flag to keyExchangeStatus in conversation model

pull/11/head
sachaaaaa 7 years ago
parent 583fb2e6c6
commit ecd300d68d

@ -76,7 +76,7 @@
return {
unreadCount: 0,
verified: textsecure.storage.protocol.VerifiedStatus.DEFAULT,
keysPending: true
keyExchangeStatus: 'none'
};
},
@ -398,29 +398,36 @@
return contact.isVerified();
});
},
isKeysPending() {
if (this.isPrivate()) {
if (this.isMe()) {
return false;
}
const keysPending = this.get('keysPending');
if (keysPending === undefined) {
keysPending = true;
}
return keysPending;
getKeyExchangeStatus() {
return this.get('keyExchangeStatus') || 'none';
},
isKeyExchangeCompleted() {
if (!this.isPrivate()) {
throw new Error(
'isKeyExchangeCompleted not implemented for groups'
);
}
throw new Error(
'isKeysPending not implemented for groups'
);
if (this.isMe()) {
return true;
}
return this.getKeyExchangeStatus() == 'completed';
},
setKeysPending(keysPending) {
if (typeof keysPending !== 'boolean') {
setKeyExchangeStatus(status) {
if (typeof status !== 'string') {
throw new Error(
'setKeyExchangeStatus expects a string'
);
}
status = status.toLowerCase();
if (['none', 'ongoing', 'completed'].indexOf(status) < 0) {
throw new Error(
'setKeysPending expects a boolean'
'unknown string value given to setKeyExchangeStatus'
);
}
this.set({ keysPending });
this.set({ keyExchangeStatus: status });
},
isUnverified() {
if (this.isPrivate()) {

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

Loading…
Cancel
Save