From 3363cc4f1d97a7556373db7bab321f4581d81e66 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Mon, 3 Sep 2018 15:02:38 +0200 Subject: [PATCH 1/2] shallow-clone the filter, so the timeline filter doesnt get written into it later on --- src/client.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client.js b/src/client.js index 9a538b77d..e2be7ac8d 100644 --- a/src/client.js +++ b/src/client.js @@ -2145,7 +2145,7 @@ function(roomId, fromToken, limit, dir, timelineFilter = undefined) { let filter = null; if (this._clientOpts.lazyLoadMembers) { - filter = LAZY_LOADING_MESSAGES_FILTER; + filter = Object.assign({}, LAZY_LOADING_MESSAGES_FILTER); } if (timelineFilter) { // XXX: it's horrific that /messages' filter parameter doesn't match From 0d24c18fed83834b3fed2fc8a131739e2f17ce61 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Tue, 4 Sep 2018 16:51:36 +0200 Subject: [PATCH 2/2] add comment to explain fix --- src/client.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/client.js b/src/client.js index e2be7ac8d..c8e2b8735 100644 --- a/src/client.js +++ b/src/client.js @@ -2145,6 +2145,8 @@ function(roomId, fromToken, limit, dir, timelineFilter = undefined) { let filter = null; if (this._clientOpts.lazyLoadMembers) { + // create a shallow copy of LAZY_LOADING_MESSAGES_FILTER, + // so the timelineFilter doesn't get written into it below filter = Object.assign({}, LAZY_LOADING_MESSAGES_FILTER); } if (timelineFilter) {