From 21af3fe189246b07f68a10d0174ae6d2723398b8 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Mon, 28 Aug 2017 00:46:28 +0100 Subject: [PATCH] modularize and invert logic, so banned etc will count as left --- src/components/views/rooms/MemberInfo.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/components/views/rooms/MemberInfo.js b/src/components/views/rooms/MemberInfo.js index 6d38797a2d..af32d60cef 100644 --- a/src/components/views/rooms/MemberInfo.js +++ b/src/components/views/rooms/MemberInfo.js @@ -40,6 +40,8 @@ import withMatrixClient from '../../../wrappers/withMatrixClient'; import AccessibleButton from '../elements/AccessibleButton'; import GeminiScrollbar from 'react-gemini-scrollbar'; +// States which both sides of the dmRoom must have for it to be considered relevant. +const joinStates = ['invite', 'join']; module.exports = withMatrixClient(React.createClass({ displayName: 'MemberInfo', @@ -620,11 +622,11 @@ module.exports = withMatrixClient(React.createClass({ const room = this.props.matrixClient.getRoom(roomId); if (room) { const me = room.getMember(this.props.matrixClient.credentials.userId); - // not a DM room if we have left it - if (!me.membership || me.membership === 'leave') continue; - // not a DM room if they have left it + // not a DM room if we have are not joined/invited + if (!me.membership || !joinStates.includes(me.membership)) continue; + // not a DM room if they are not joined/invited const them = this.props.member; - if (!them.membership || them.membership === 'leave') continue; + if (!them.membership || !joinStates.includes(them.membership)) continue; const highlight = room.getUnreadNotificationCount('highlight') > 0 || me.membership === 'invite';