From 2a0c85c7723bd57f5ad8bc9b4ea0c8efaeb538f8 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Thu, 13 Jun 2019 12:06:54 +0200 Subject: [PATCH] add hasAssociation helper --- src/models/event.js | 9 +++++++++ src/scheduler.js | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/models/event.js b/src/models/event.js index 560ca1103..50adc34a8 100644 --- a/src/models/event.js +++ b/src/models/event.js @@ -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. * diff --git a/src/scheduler.js b/src/scheduler.js index b3461bebd..a799597b9 100644 --- a/src/scheduler.js +++ b/src/scheduler.js @@ -178,7 +178,7 @@ MatrixScheduler.RETRY_BACKOFF_RATELIMIT = function(event, attempts, err) { */ MatrixScheduler.QUEUE_MESSAGES = function(event) { // 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. return "message"; }