From 83c6615d6ed652b70b90692ad40a43e29cc34d01 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Wed, 25 Jul 2018 14:53:41 +0200 Subject: [PATCH] move me || syncedmembership code into room.getmymembership --- src/models/room.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/models/room.js b/src/models/room.js index bbd778859..8c2a345aa 100644 --- a/src/models/room.js +++ b/src/models/room.js @@ -224,13 +224,19 @@ Room.prototype.getLastEventId = function() { }; /** - * @return {string} the membership type (join | leave | invite) this room was received as during sync + * @param {string} myUserId the user id for the logged in member + * @return {string} the membership type (join | leave | invite) for the logged in user */ -Room.prototype.getSyncedMembership = function() { +Room.prototype.getMyMembership = function(myUserId) { + if (myUserId) { + const me = this.getMember(myUserId); + if (me) { + return me.membership; + } + } return this._syncedMembership; }; - /** * Sets the membership this room was received as during sync * @param {string} membership join | leave | invite