diff --git a/src/client.js b/src/client.js index 892e144f1..505c109d8 100644 --- a/src/client.js +++ b/src/client.js @@ -3594,6 +3594,16 @@ module.exports.CRYPTO_ENABLED = CRYPTO_ENABLED; * }); */ +/** + * Fires when the JS SDK receives a M_CONSENT_NOT_GIVEN error in response + * to a HTTP request. + * @event module:client~MatrixClient#"no_consent" + * @example + * matrixClient.on("no_consent", function(message, contentUri) { + * console.info(message + ' Go to ' + contentUri); + * }); + */ + /** * Fires when a device is marked as verified/unverified/blocked/unblocked by * {@link module:client~MatrixClient#setDeviceVerified|MatrixClient.setDeviceVerified} or diff --git a/src/http-api.js b/src/http-api.js index edc7fab56..ec0d59dbf 100644 --- a/src/http-api.js +++ b/src/http-api.js @@ -433,6 +433,12 @@ module.exports.MatrixHttpApi.prototype = { requestPromise.catch(function(err) { if (err.errcode == 'M_UNKNOWN_TOKEN') { self.event_emitter.emit("Session.logged_out"); + } else if (err.errcode == 'M_CONSENT_NOT_GIVEN') { + self.event_emitter.emit( + "no_consent", + err.message, + err.data.consent_uri, + ); } });