From 9610e9b57e25e4da6f41e070b43ff0cc50c7287c Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Tue, 16 Apr 2019 11:43:32 +0200 Subject: [PATCH] take into account continuation tiles in when checking timeline messages --- src/usecases/timeline.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/usecases/timeline.js b/src/usecases/timeline.js index 71e47fbfbb..5556660e1c 100644 --- a/src/usecases/timeline.js +++ b/src/usecases/timeline.js @@ -81,7 +81,16 @@ module.exports.checkTimelineContains = async function (session, expectedMessages return getMessageFromEventTile(eventTile); })); //filter out tiles that were not messages - timelineMessages = timelineMessages .filter((m) => !!m); + timelineMessages = timelineMessages.filter((m) => !!m); + timelineMessages.reduce((prevSender, m) => { + if (m.continuation) { + m.sender = prevSender; + return prevSender; + } else { + return m.sender; + } + }); + expectedMessages.forEach((expectedMessage) => { const foundMessage = timelineMessages.find((message) => { return message.sender === expectedMessage.sender && @@ -132,6 +141,7 @@ async function getMessageFromEventTile(eventTile) { return { sender, body, - encrypted: classNames.includes("mx_EventTile_verified") + encrypted: classNames.includes("mx_EventTile_verified"), + continuation: classNames.includes("mx_EventTile_continuation"), }; }