You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-29 16:43:09 +03:00
Only re-emit events from Event objects if needed
The only event and Event emits is 'Event.decrypted', so don't bother to add listeners if the event isn't encrypted.
This commit is contained in:
@@ -3274,10 +3274,10 @@ function _resolve(callback, defer, res) {
|
|||||||
function _PojoToMatrixEventMapper(client) {
|
function _PojoToMatrixEventMapper(client) {
|
||||||
function mapper(plainOldJsObject) {
|
function mapper(plainOldJsObject) {
|
||||||
const event = new MatrixEvent(plainOldJsObject);
|
const event = new MatrixEvent(plainOldJsObject);
|
||||||
|
if (event.isEncrypted()) {
|
||||||
reEmit(client, event, [
|
reEmit(client, event, [
|
||||||
"Event.decrypted",
|
"Event.decrypted",
|
||||||
]);
|
]);
|
||||||
if (event.isEncrypted()) {
|
|
||||||
event.attemptDecryption(client._crypto);
|
event.attemptDecryption(client._crypto);
|
||||||
}
|
}
|
||||||
return event;
|
return event;
|
||||||
|
|||||||
Reference in New Issue
Block a user