diff --git a/client/sidebar/RoomList.js b/client/sidebar/RoomList.js index 1794eb669de7a..4486d525305a2 100644 --- a/client/sidebar/RoomList.js +++ b/client/sidebar/RoomList.js @@ -203,7 +203,7 @@ export const SideBarItemTemplateWithData = React.memo(function SideBarItemTempla style={style} badges={badges} avatar={AvatarTemplate && } - menu={!isAnonymous && !isQueued && (() => )} + menu={!isAnonymous && !isQueued && (() => )} />; }, (prevProps, nextProps) => { if (['id', 'style', 'extended', 'selected', 'SideBarItemTemplate', 'AvatarTemplate', 't', 'sidebarViewMode'].some((key) => prevProps[key] !== nextProps[key])) { diff --git a/client/sidebar/RoomMenu.js b/client/sidebar/RoomMenu.js index 8877dc9cfdb79..4f8c9dee783eb 100644 --- a/client/sidebar/RoomMenu.js +++ b/client/sidebar/RoomMenu.js @@ -20,7 +20,7 @@ const fields = { name: 1, }; -const RoomMenu = React.memo(({ rid, unread, roomOpen, type, cl, name = '' }) => { +const RoomMenu = React.memo(({ rid, unread, threadUnread, alert, roomOpen, type, cl, name = '' }) => { const t = useTranslation(); const dispatchToastMessage = useToastMessageDispatch(); const setModal = useSetModal(); @@ -39,6 +39,8 @@ const RoomMenu = React.memo(({ rid, unread, roomOpen, type, cl, name = '' }) => const toggleFavorite = useMethod('toggleFavorite'); const leaveRoom = useMethod('leaveRoom'); + const isUnread = alert || unread || threadUnread; + const canLeaveChannel = usePermission('leave-c'); const canLeavePrivate = usePermission('leave-p'); @@ -98,7 +100,7 @@ const RoomMenu = React.memo(({ rid, unread, roomOpen, type, cl, name = '' }) => const handleToggleRead = useMutableCallback(async () => { try { - if (unread) { + if (isUnread) { await readMessages(rid); return; } @@ -128,7 +130,7 @@ const RoomMenu = React.memo(({ rid, unread, roomOpen, type, cl, name = '' }) => action: handleHide, }, toggleRead: { - label: { label: unread ? t('Mark_read') : t('Mark_unread'), icon: 'flag' }, + label: { label: isUnread ? t('Mark_read') : t('Mark_unread'), icon: 'flag' }, action: handleToggleRead, }, ...canFavorite && { toggleFavorite: { @@ -139,7 +141,7 @@ const RoomMenu = React.memo(({ rid, unread, roomOpen, type, cl, name = '' }) => label: { label: t('Leave_room'), icon: 'sign-out' }, action: handleLeave, } }, - }), [canFavorite, canLeave, handleHide, handleLeave, handleToggleFavorite, handleToggleRead, isFavorite, t, unread]); + }), [t, handleHide, isUnread, handleToggleRead, canFavorite, isFavorite, handleToggleFavorite, canLeave, handleLeave]); return