From 9685ef4dd3feda52163f405f72fcd314d6b232e6 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Fri, 11 Feb 2022 18:39:37 +0100 Subject: [PATCH] dont log summary valued, as they can contain PII --- src/matrix/room/Room.js | 2 +- src/matrix/room/RoomSummary.js | 13 ++++--------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/matrix/room/Room.js b/src/matrix/room/Room.js index a5bce14f..12c17580 100644 --- a/src/matrix/room/Room.js +++ b/src/matrix/room/Room.js @@ -158,7 +158,7 @@ export class Room extends BaseRoom { summaryChanges = this._summary.writeData(summaryChanges, txn); } if (summaryChanges) { - log.set("summaryChanges", summaryChanges.diff(this._summary.data)); + log.set("summaryChanges", summaryChanges.changedKeys(this._summary.data)); } // fetch new members while we have txn open, // but don't make any in-memory changes yet diff --git a/src/matrix/room/RoomSummary.js b/src/matrix/room/RoomSummary.js index 410352ca..a3dec467 100644 --- a/src/matrix/room/RoomSummary.js +++ b/src/matrix/room/RoomSummary.js @@ -203,16 +203,11 @@ export class SummaryData { this.cloned = copy ? true : false; } - diff(other) { + changedKeys(other) { const props = Object.getOwnPropertyNames(this); - return props.reduce((diff, prop) => { - if (prop !== "cloned") { - if (this[prop] !== other[prop]) { - diff[prop] = this[prop]; - } - } - return diff; - }, {}); + return props.filter(prop => { + return prop !== "cloned" && this[prop] !== other[prop] + }); } cloneIfNeeded() {