From 5be4287230b65eac84cae8636f6536dd937b1d45 Mon Sep 17 00:00:00 2001 From: Ajay Bura Date: Tue, 15 Mar 2022 12:47:18 +0530 Subject: [PATCH] Fix muted room show unread indicator Signed-off-by: Ajay Bura --- src/app/organisms/navigation/RoomsCategory.jsx | 2 +- src/app/organisms/navigation/Selector.jsx | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/app/organisms/navigation/RoomsCategory.jsx b/src/app/organisms/navigation/RoomsCategory.jsx index f31e72f6..b5666512 100644 --- a/src/app/organisms/navigation/RoomsCategory.jsx +++ b/src/app/organisms/navigation/RoomsCategory.jsx @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; import './RoomsCategory.scss'; import initMatrix from '../../../client/initMatrix'; -import { selectSpace, selectRoom,openReusableContextMenu } from '../../../client/action/navigation'; +import { selectSpace, selectRoom, openReusableContextMenu } from '../../../client/action/navigation'; import { getEventCords } from '../../../util/common'; import Text from '../../atoms/text/Text'; diff --git a/src/app/organisms/navigation/Selector.jsx b/src/app/organisms/navigation/Selector.jsx index 56e57c57..cb1086ea 100644 --- a/src/app/organisms/navigation/Selector.jsx +++ b/src/app/organisms/navigation/Selector.jsx @@ -3,6 +3,7 @@ import React, { useEffect } from 'react'; import PropTypes from 'prop-types'; import initMatrix from '../../../client/initMatrix'; +import cons from '../../../client/state/cons'; import navigation from '../../../client/state/navigation'; import { openReusableContextMenu } from '../../../client/action/navigation'; import { getEventCords, abbreviateNumber } from '../../../util/common'; @@ -23,9 +24,12 @@ function Selector({ const mx = initMatrix.matrixClient; const noti = initMatrix.notifications; const room = mx.getRoom(roomId); + let imageSrc = room.getAvatarFallbackMember()?.getAvatarUrl(mx.baseUrl, 24, 24, 'crop') || null; if (imageSrc === null) imageSrc = room.getAvatarUrl(mx.baseUrl, 24, 24, 'crop') || null; + const isMuted = noti.getNotiType(roomId) === cons.notifs.MUTE; + const [, forceUpdate] = useForceUpdate(); useEffect(() => { @@ -56,7 +60,8 @@ function Selector({ imageSrc={isDM ? imageSrc : null} iconSrc={isDM ? null : joinRuleToIconSrc(room.getJoinRule(), room.isSpaceRoom())} isSelected={navigation.selectedRoomId === roomId} - isUnread={noti.hasNoti(roomId)} + isMuted={isMuted} + isUnread={!isMuted && noti.hasNoti(roomId)} notificationCount={abbreviateNumber(noti.getTotalNoti(roomId))} isAlert={noti.getHighlightNoti(roomId) !== 0} onClick={onClick}