mirror of
https://github.com/element-hq/element-web.git
synced 2024-12-16 22:41:48 +03:00
add comment and remove redundant logic
This commit is contained in:
parent
21af3fe189
commit
9658efd6d7
1 changed files with 8 additions and 7 deletions
|
@ -40,9 +40,6 @@ 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',
|
||||
|
||||
|
@ -613,6 +610,10 @@ module.exports = withMatrixClient(React.createClass({
|
|||
var startChat, kickButton, banButton, muteButton, giveModButton, spinner;
|
||||
if (this.props.member.userId !== this.props.matrixClient.credentials.userId) {
|
||||
const dmRoomMap = new DMRoomMap(this.props.matrixClient);
|
||||
// dmRooms will not include dmRooms that we have been invited into but did not join.
|
||||
// Because DMRoomMap runs off account_data[m.direct] which is only set on join of dm room.
|
||||
// XXX: we potentially want DMs we have been invited to, to also show up here :L
|
||||
// especially as logic below concerns specially if we haven't joined but have been invited
|
||||
const dmRooms = dmRoomMap.getDMRoomsForUserId(this.props.member.userId);
|
||||
|
||||
const RoomTile = sdk.getComponent("rooms.RoomTile");
|
||||
|
@ -622,11 +623,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 are not joined/invited
|
||||
if (!me.membership || !joinStates.includes(me.membership)) continue;
|
||||
// not a DM room if they are not joined/invited
|
||||
// not a DM room if we have are not joined
|
||||
if (!me.membership || me.membership !== 'join') continue;
|
||||
// not a DM room if they are not joined
|
||||
const them = this.props.member;
|
||||
if (!them.membership || !joinStates.includes(them.membership)) continue;
|
||||
if (!them.membership || them.membership !== 'join') continue;
|
||||
|
||||
const highlight = room.getUnreadNotificationCount('highlight') > 0 || me.membership === 'invite';
|
||||
|
||||
|
|
Loading…
Reference in a new issue