From 22a86b5351addda32d9919432f6b4d8aba0735c8 Mon Sep 17 00:00:00 2001 From: sachaaaaa Date: Mon, 1 Oct 2018 17:49:39 +1000 Subject: [PATCH] store key bundle status in conversation model --- js/models/conversations.js | 13 +++++++++++++ js/views/conversation_view.js | 3 ++- ts/components/conversation/ConversationHeader.tsx | 4 +++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/js/models/conversations.js b/js/models/conversations.js index 7e21dee6f..af5626432 100644 --- a/js/models/conversations.js +++ b/js/models/conversations.js @@ -76,6 +76,7 @@ return { unreadCount: 0, verified: textsecure.storage.protocol.VerifiedStatus.DEFAULT, + keysPending: true }; }, @@ -397,6 +398,18 @@ return contact.isVerified(); }); }, + isKeysPending() { + if (this.isPrivate()) { + if (this.isMe()) { + return false; + } + return this.get('keysPending') || true; + } + + throw new Error( + 'isKeysPending not implemented for groups' + ); + }, isUnverified() { if (this.isPrivate()) { const verified = this.get('verified'); diff --git a/js/views/conversation_view.js b/js/views/conversation_view.js index d602a5b92..a91b9e536 100644 --- a/js/views/conversation_view.js +++ b/js/views/conversation_view.js @@ -126,7 +126,7 @@ this.lazyUpdateVerified = _.debounce( this.model.updateVerified.bind(this.model), 1000 // one second - ); + ); this.throttledGetProfiles = _.throttle( this.model.getProfiles.bind(this.model), 1000 * 60 * 5 // five minutes @@ -160,6 +160,7 @@ color: this.model.getColor(), avatarPath, isVerified: this.model.isVerified(), + isKeysPending: this.model.isKeysPending(), isMe: this.model.isMe(), isGroup: !this.model.isPrivate(), expirationSettingName, diff --git a/ts/components/conversation/ConversationHeader.tsx b/ts/components/conversation/ConversationHeader.tsx index 0229db359..44980d234 100644 --- a/ts/components/conversation/ConversationHeader.tsx +++ b/ts/components/conversation/ConversationHeader.tsx @@ -22,6 +22,7 @@ interface Trigger { interface Props { i18n: Localizer; isVerified: boolean; + isKeysPending: boolean; name?: string; id: string; phoneNumber: string; @@ -88,7 +89,7 @@ export class ConversationHeader extends React.Component { } public renderTitle() { - const { name, phoneNumber, i18n, profileName, isVerified } = this.props; + const { name, phoneNumber, i18n, profileName, isVerified, isKeysPending } = this.props; return (
@@ -107,6 +108,7 @@ export class ConversationHeader extends React.Component { {i18n('verified')} ) : null} + {isKeysPending ? '(pending)' : null}
); }