1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-28 05:03:59 +03:00

add hasAssociation helper

This commit is contained in:
Bruno Windels
2019-06-13 12:06:54 +02:00
parent 3488fbe64c
commit 2a0c85c772
2 changed files with 10 additions and 1 deletions

View File

@@ -921,6 +921,15 @@ utils.extend(module.exports.MatrixEvent.prototype, {
} }
}, },
/**
* Checks if this event is associated with another event. See `getAssociatedId`.
*
* @return {bool}
*/
hasAssocation() {
return !!this.getAssociatedId();
},
/** /**
* Update the related id with a new one. * Update the related id with a new one.
* *

View File

@@ -178,7 +178,7 @@ MatrixScheduler.RETRY_BACKOFF_RATELIMIT = function(event, attempts, err) {
*/ */
MatrixScheduler.QUEUE_MESSAGES = function(event) { MatrixScheduler.QUEUE_MESSAGES = function(event) {
// enqueue messages or events that associate with another event (redactions and relations) // enqueue messages or events that associate with another event (redactions and relations)
if (event.getType() === "m.room.message" || !!event.getAssociatedId()) { if (event.getType() === "m.room.message" || event.hasAssocation()) {
// put these events in the 'message' queue. // put these events in the 'message' queue.
return "message"; return "message";
} }