From cfd76587f60887be2c155ab127e7a7798dd022cb Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Thu, 25 Jun 2020 16:12:45 +1000 Subject: [PATCH] remove getSendOptions and getNumberInfo() --- js/conversation_controller.js | 6 +-- js/models/conversations.js | 72 ----------------------------------- 2 files changed, 2 insertions(+), 76 deletions(-) diff --git a/js/conversation_controller.js b/js/conversation_controller.js index c018f9abc..faa38d844 100644 --- a/js/conversation_controller.js +++ b/js/conversation_controller.js @@ -206,12 +206,10 @@ ); }); }, - prepareForSend(id, options) { + prepareForSend(id) { // id is either a group id or an individual user's id const conversation = this.get(id); - const sendOptions = conversation - ? conversation.getSendOptions(options) - : null; + const sendOptions = {}; const wrap = conversation ? conversation.wrapSend.bind(conversation) : promise => promise; diff --git a/js/models/conversations.js b/js/models/conversations.js index 3f71ae135..a99ccbccc 100644 --- a/js/models/conversations.js +++ b/js/models/conversations.js @@ -1531,78 +1531,6 @@ ); }, - getSendOptions(options = {}) { - const senderCertificate = storage.get('senderCertificate'); - const numberInfo = this.getNumberInfo(options); - - return { - senderCertificate, - numberInfo, - }; - }, - - getNumberInfo(options = {}) { - const { syncMessage, disableMeCheck } = options; - - if (!this.ourNumber) { - return null; - } - - // START: this code has an Expiration date of ~2018/11/21 - // We don't want to enable unidentified delivery for send unless it is - // also enabled for our own account. - const me = ConversationController.getOrCreate(this.ourNumber, 'private'); - if ( - !disableMeCheck && - me.get('sealedSender') === SEALED_SENDER.DISABLED - ) { - return null; - } - // END - - if (!this.isPrivate()) { - const infoArray = this.contactCollection.map(conversation => - conversation.getNumberInfo(options) - ); - return Object.assign({}, ...infoArray); - } - - const accessKey = this.get('accessKey'); - const sealedSender = this.get('sealedSender'); - - // We never send sync messages as sealed sender - if (syncMessage && this.id === this.ourNumber) { - return null; - } - - // If we've never fetched user's profile, we default to what we have - if (sealedSender === SEALED_SENDER.UNKNOWN) { - return { - [this.id]: { - accessKey: - accessKey || - window.Signal.Crypto.arrayBufferToBase64( - window.Signal.Crypto.getRandomBytes(16) - ), - }, - }; - } - - if (sealedSender === SEALED_SENDER.DISABLED) { - return null; - } - - return { - [this.id]: { - accessKey: - accessKey && sealedSender === SEALED_SENDER.ENABLED - ? accessKey - : window.Signal.Crypto.arrayBufferToBase64( - window.Signal.Crypto.getRandomBytes(16) - ), - }, - }; - }, async updateSwarmNodes(swarmNodes) { this.set({ swarmNodes }); await window.Signal.Data.updateConversation(this.id, this.attributes, {