Removed unused state.

pull/50/head
Mikunj 7 years ago
parent 50e8f65a7e
commit 4fd709be35

@ -80,7 +80,6 @@
verified: textsecure.storage.protocol.VerifiedStatus.DEFAULT, verified: textsecure.storage.protocol.VerifiedStatus.DEFAULT,
isFriend: false, isFriend: false,
keyExchangeCompleted: false, keyExchangeCompleted: false,
blockInput: false,
unlockTimestamp: null, // Timestamp used for expiring friend requests. unlockTimestamp: null, // Timestamp used for expiring friend requests.
}; };
}, },
@ -1094,31 +1093,21 @@
return true; return true;
}); });
}, },
async updateBlockInput(blockInput) {
if (this.get('blockInput') === blockInput) return;
this.set({ blockInput });
await window.Signal.Data.updateConversation(this.id, this.attributes, {
Conversation: Whisper.Conversation,
});
},
async updateTextInputState() { async updateTextInputState() {
// Check if we need to disable the text field // Check if we need to disable the text field
if (!this.isFriend()) { if (!this.isFriend()) {
// Disable the input if we're waiting for friend request approval // Disable the input if we're waiting for friend request approval
const waiting = await this.waitingForFriendRequestApproval(); const waiting = await this.waitingForFriendRequestApproval();
if (waiting) { if (waiting) {
await this.updateBlockInput(true);
this.trigger('disable:input', true); this.trigger('disable:input', true);
this.trigger('change:placeholder', 'disabled'); this.trigger('change:placeholder', 'disabled');
return; return;
} }
// Tell the user to introduce themselves // Tell the user to introduce themselves
await this.updateBlockInput(false);
this.trigger('disable:input', false); this.trigger('disable:input', false);
this.trigger('change:placeholder', 'friend-request'); this.trigger('change:placeholder', 'friend-request');
return; return;
} }
await this.updateBlockInput(false);
this.trigger('disable:input', false); this.trigger('disable:input', false);
this.trigger('change:placeholder', 'chat'); this.trigger('change:placeholder', 'chat');
}, },

@ -69,16 +69,9 @@
}, },
template: $('#conversation').html(), template: $('#conversation').html(),
render_attributes() { render_attributes() {
let sendMessagePlaceholder = 'sendMessageFriendRequest';
const sendDisabled = this.model.get('blockInput');
if (sendDisabled) {
sendMessagePlaceholder = 'sendMessageDisabled';
} else if (this.model.isFriend()) {
sendMessagePlaceholder = 'sendMessage';
}
return { return {
'disable-inputs': sendDisabled, 'disable-inputs': false,
'send-message': i18n(sendMessagePlaceholder), 'send-message': i18n('sendMessage'),
'android-length-warning': i18n('androidMessageLengthWarning'), 'android-length-warning': i18n('androidMessageLengthWarning'),
}; };
}, },

Loading…
Cancel
Save