1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-26 17:03:12 +03:00

Megolm: remove redundant requestKeysOnFail

We now *always* requestKeysOnFail, so this was dead code which we can remove.
This commit is contained in:
Richard van der Hoff
2017-08-10 13:00:27 +01:00
parent 92a75aaa08
commit 9550bca099

View File

@@ -535,18 +535,11 @@ utils.inherits(MegolmDecryption, base.DecryptionAlgorithm);
* *
* @param {MatrixEvent} event * @param {MatrixEvent} event
* *
* @return {Promise} resolves once we have finished decrypting. Rejects with an * returns a promise which resolves once we have finished decrypting, or
* `algorithms.DecryptionError` if there is a problem decrypting the event. * rejects with an `algorithms.DecryptionError` if there is a problem
* decrypting the event.
*/ */
MegolmDecryption.prototype.decryptEvent = function(event) { MegolmDecryption.prototype.decryptEvent = async function(event) {
return this._decryptEvent(event, true);
};
// helper for the real decryptEvent and for _retryDecryption. If
// requestKeysOnFail is true, we'll send an m.room_key_request when we fail
// to decrypt the event due to missing megolm keys.
MegolmDecryption.prototype._decryptEvent = async function(event, requestKeysOnFail) {
const content = event.getWireContent(); const content = event.getWireContent();
if (!content.sender_key || !content.session_id || if (!content.sender_key || !content.session_id ||
@@ -563,9 +556,7 @@ MegolmDecryption.prototype._decryptEvent = async function(event, requestKeysOnFa
} catch (e) { } catch (e) {
if (e.message === 'OLM.UNKNOWN_MESSAGE_INDEX') { if (e.message === 'OLM.UNKNOWN_MESSAGE_INDEX') {
this._addEventToPendingList(event); this._addEventToPendingList(event);
if (requestKeysOnFail) { this._requestKeysForEvent(event);
this._requestKeysForEvent(event);
}
} }
throw new base.DecryptionError( throw new base.DecryptionError(
e.toString(), { e.toString(), {
@@ -577,9 +568,7 @@ MegolmDecryption.prototype._decryptEvent = async function(event, requestKeysOnFa
if (res === null) { if (res === null) {
// We've got a message for a session we don't have. // We've got a message for a session we don't have.
this._addEventToPendingList(event); this._addEventToPendingList(event);
if (requestKeysOnFail) { this._requestKeysForEvent(event);
this._requestKeysForEvent(event);
}
throw new base.DecryptionError( throw new base.DecryptionError(
"The sender's device has not sent us the keys for this message.", "The sender's device has not sent us the keys for this message.",
{ {