From d521795cf8c28ab5b2c68da33f21f8d499843a96 Mon Sep 17 00:00:00 2001 From: sachaaaaa Date: Tue, 2 Oct 2018 08:53:59 +1000 Subject: [PATCH] add helper to set the keysPending flag for a discussion --- js/models/conversations.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/js/models/conversations.js b/js/models/conversations.js index af5626432..774b4207c 100644 --- a/js/models/conversations.js +++ b/js/models/conversations.js @@ -403,13 +403,25 @@ if (this.isMe()) { return false; } - return this.get('keysPending') || true; + const keysPending = this.get('keysPending'); + if (keysPending === undefined) { + keysPending = true; + } + return keysPending; } throw new Error( 'isKeysPending not implemented for groups' ); }, + setKeysPending(keysPending) { + if (typeof keysPending !== 'boolean') { + throw new Error( + 'setKeysPending expects a boolean' + ); + } + this.set({ keysPending }); + }, isUnverified() { if (this.isPrivate()) { const verified = this.get('verified');