Room Context Menu should respond to tag changes (#7154)
This commit is contained in:
parent
e4d645e360
commit
c457da4c6b
1 changed files with 7 additions and 2 deletions
|
@ -28,7 +28,7 @@ import { _t } from "../../../languageHandler";
|
||||||
import MatrixClientContext from "../../../contexts/MatrixClientContext";
|
import MatrixClientContext from "../../../contexts/MatrixClientContext";
|
||||||
import { ButtonEvent } from "../elements/AccessibleButton";
|
import { ButtonEvent } from "../elements/AccessibleButton";
|
||||||
import { DefaultTagID, TagID } from "../../../stores/room-list/models";
|
import { DefaultTagID, TagID } from "../../../stores/room-list/models";
|
||||||
import RoomListStore from "../../../stores/room-list/RoomListStore";
|
import RoomListStore, { LISTS_UPDATE_EVENT } from "../../../stores/room-list/RoomListStore";
|
||||||
import dis from "../../../dispatcher/dispatcher";
|
import dis from "../../../dispatcher/dispatcher";
|
||||||
import RoomListActions from "../../../actions/RoomListActions";
|
import RoomListActions from "../../../actions/RoomListActions";
|
||||||
import { Key } from "../../../Keyboard";
|
import { Key } from "../../../Keyboard";
|
||||||
|
@ -43,6 +43,7 @@ import { SetRightPanelPhasePayload } from "../../../dispatcher/payloads/SetRight
|
||||||
import { Action } from "../../../dispatcher/actions";
|
import { Action } from "../../../dispatcher/actions";
|
||||||
import { RightPanelPhases } from "../../../stores/RightPanelStorePhases";
|
import { RightPanelPhases } from "../../../stores/RightPanelStorePhases";
|
||||||
import { ROOM_NOTIFICATIONS_TAB } from "../dialogs/RoomSettingsDialog";
|
import { ROOM_NOTIFICATIONS_TAB } from "../dialogs/RoomSettingsDialog";
|
||||||
|
import { useEventEmitterState } from "../../../hooks/useEventEmitter";
|
||||||
|
|
||||||
interface IProps extends IContextMenuProps {
|
interface IProps extends IContextMenuProps {
|
||||||
room: Room;
|
room: Room;
|
||||||
|
@ -50,7 +51,11 @@ interface IProps extends IContextMenuProps {
|
||||||
|
|
||||||
const RoomContextMenu = ({ room, onFinished, ...props }: IProps) => {
|
const RoomContextMenu = ({ room, onFinished, ...props }: IProps) => {
|
||||||
const cli = useContext(MatrixClientContext);
|
const cli = useContext(MatrixClientContext);
|
||||||
const roomTags = RoomListStore.instance.getTagsForRoom(room);
|
const roomTags = useEventEmitterState(
|
||||||
|
RoomListStore.instance,
|
||||||
|
LISTS_UPDATE_EVENT,
|
||||||
|
() => RoomListStore.instance.getTagsForRoom(room),
|
||||||
|
);
|
||||||
|
|
||||||
let leaveOption: JSX.Element;
|
let leaveOption: JSX.Element;
|
||||||
if (roomTags.includes(DefaultTagID.Archived)) {
|
if (roomTags.includes(DefaultTagID.Archived)) {
|
||||||
|
|
Loading…
Reference in a new issue