From 9d5fc7c0fdfc26a542fa438e02accccd93a203dc Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Fri, 17 Jul 2015 18:01:58 +0100 Subject: [PATCH] at long last fix bug where /op would cache previous failed attempts. fixes SYWEB-342 --- lib/client.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/client.js b/lib/client.js index 18ed917f5..ad5a3b5b6 100644 --- a/lib/client.js +++ b/lib/client.js @@ -211,7 +211,9 @@ MatrixClient.prototype.setPowerLevel = function(roomId, userId, powerLevel, users: {} }; if (event && event.getType() === "m.room.power_levels") { - content = event.getContent(); + // take a copy of the content to ensure we don't corrupt + // existing client state with a failed power level change + content = utils.deepCopy(event.getContent()); } content.users[userId] = powerLevel; var path = utils.encodeUri("/rooms/$roomId/state/m.room.power_levels", {