You've already forked matrix-react-sdk
							
							
				mirror of
				https://github.com/matrix-org/matrix-react-sdk.git
				synced 2025-11-03 00:33:22 +03:00 
			
		
		
		
	Add view_room to Action enum (#7203)
				
					
				
			* Add ViewRoom action to Action enum Signed-off-by: Renan <renancleyson.f@gmail.com> * Change view_room occurrences to Action.ViewRoom Signed-off-by: Renan <renancleyson.f@gmail.com> * Add missing Action import
This commit is contained in:
		@@ -925,7 +925,7 @@ export default class CallHandler extends EventEmitter {
 | 
				
			|||||||
                this.setActiveCallRoomId(payload.room_id);
 | 
					                this.setActiveCallRoomId(payload.room_id);
 | 
				
			||||||
                CountlyAnalytics.instance.trackJoinCall(payload.room_id, call.type === CallType.Video, false);
 | 
					                CountlyAnalytics.instance.trackJoinCall(payload.room_id, call.type === CallType.Video, false);
 | 
				
			||||||
                dis.dispatch({
 | 
					                dis.dispatch({
 | 
				
			||||||
                    action: "view_room",
 | 
					                    action: Action.ViewRoom,
 | 
				
			||||||
                    room_id: payload.room_id,
 | 
					                    room_id: payload.room_id,
 | 
				
			||||||
                });
 | 
					                });
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
@@ -974,7 +974,7 @@ export default class CallHandler extends EventEmitter {
 | 
				
			|||||||
        const roomId = await ensureDMExists(MatrixClientPeg.get(), nativeUserId);
 | 
					        const roomId = await ensureDMExists(MatrixClientPeg.get(), nativeUserId);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        dis.dispatch({
 | 
					        dis.dispatch({
 | 
				
			||||||
            action: 'view_room',
 | 
					            action: Action.ViewRoom,
 | 
				
			||||||
            room_id: roomId,
 | 
					            room_id: roomId,
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1005,7 +1005,7 @@ export default class CallHandler extends EventEmitter {
 | 
				
			|||||||
                transferee: call,
 | 
					                transferee: call,
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
            dis.dispatch({
 | 
					            dis.dispatch({
 | 
				
			||||||
                action: 'view_room',
 | 
					                action: Action.ViewRoom,
 | 
				
			||||||
                room_id: dmRoomId,
 | 
					                room_id: dmRoomId,
 | 
				
			||||||
                should_peek: false,
 | 
					                should_peek: false,
 | 
				
			||||||
                joining: false,
 | 
					                joining: false,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -528,7 +528,7 @@ export const Commands = [
 | 
				
			|||||||
                    }
 | 
					                    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    dis.dispatch({
 | 
					                    dis.dispatch({
 | 
				
			||||||
                        action: 'view_room',
 | 
					                        action: Action.ViewRoom,
 | 
				
			||||||
                        room_alias: roomAlias,
 | 
					                        room_alias: roomAlias,
 | 
				
			||||||
                        auto_join: true,
 | 
					                        auto_join: true,
 | 
				
			||||||
                        _type: "slash_command", // instrumentation
 | 
					                        _type: "slash_command", // instrumentation
 | 
				
			||||||
@@ -538,7 +538,7 @@ export const Commands = [
 | 
				
			|||||||
                    const [roomId, ...viaServers] = params;
 | 
					                    const [roomId, ...viaServers] = params;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    dis.dispatch({
 | 
					                    dis.dispatch({
 | 
				
			||||||
                        action: 'view_room',
 | 
					                        action: Action.ViewRoom,
 | 
				
			||||||
                        room_id: roomId,
 | 
					                        room_id: roomId,
 | 
				
			||||||
                        opts: {
 | 
					                        opts: {
 | 
				
			||||||
                            // These are passed down to the js-sdk's /join call
 | 
					                            // These are passed down to the js-sdk's /join call
 | 
				
			||||||
@@ -569,7 +569,7 @@ export const Commands = [
 | 
				
			|||||||
                    const eventId = permalinkParts.eventId;
 | 
					                    const eventId = permalinkParts.eventId;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    const dispatch = {
 | 
					                    const dispatch = {
 | 
				
			||||||
                        action: 'view_room',
 | 
					                        action: Action.ViewRoom,
 | 
				
			||||||
                        auto_join: true,
 | 
					                        auto_join: true,
 | 
				
			||||||
                        _type: "slash_command", // instrumentation
 | 
					                        _type: "slash_command", // instrumentation
 | 
				
			||||||
                    };
 | 
					                    };
 | 
				
			||||||
@@ -1047,7 +1047,7 @@ export const Commands = [
 | 
				
			|||||||
                const roomId = await ensureDMExists(MatrixClientPeg.get(), userId);
 | 
					                const roomId = await ensureDMExists(MatrixClientPeg.get(), userId);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                dis.dispatch({
 | 
					                dis.dispatch({
 | 
				
			||||||
                    action: 'view_room',
 | 
					                    action: Action.ViewRoom,
 | 
				
			||||||
                    room_id: roomId,
 | 
					                    room_id: roomId,
 | 
				
			||||||
                });
 | 
					                });
 | 
				
			||||||
            })());
 | 
					            })());
 | 
				
			||||||
@@ -1069,7 +1069,7 @@ export const Commands = [
 | 
				
			|||||||
                            const cli = MatrixClientPeg.get();
 | 
					                            const cli = MatrixClientPeg.get();
 | 
				
			||||||
                            const roomId = await ensureDMExists(cli, userId);
 | 
					                            const roomId = await ensureDMExists(cli, userId);
 | 
				
			||||||
                            dis.dispatch({
 | 
					                            dis.dispatch({
 | 
				
			||||||
                                action: 'view_room',
 | 
					                                action: Action.ViewRoom,
 | 
				
			||||||
                                room_id: roomId,
 | 
					                                room_id: roomId,
 | 
				
			||||||
                            });
 | 
					                            });
 | 
				
			||||||
                            if (msg) {
 | 
					                            if (msg) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -495,7 +495,7 @@ function textForPowerEvent(event: MatrixEvent): () => string | null {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
const onPinnedOrUnpinnedMessageClick = (messageId: string, roomId: string): void => {
 | 
					const onPinnedOrUnpinnedMessageClick = (messageId: string, roomId: string): void => {
 | 
				
			||||||
    defaultDispatcher.dispatch({
 | 
					    defaultDispatcher.dispatch({
 | 
				
			||||||
        action: 'view_room',
 | 
					        action: Action.ViewRoom,
 | 
				
			||||||
        event_id: messageId,
 | 
					        event_id: messageId,
 | 
				
			||||||
        highlighted: true,
 | 
					        highlighted: true,
 | 
				
			||||||
        room_id: roomId,
 | 
					        room_id: roomId,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -175,7 +175,7 @@ class FeaturedRoom extends React.Component {
 | 
				
			|||||||
        e.stopPropagation();
 | 
					        e.stopPropagation();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        dis.dispatch({
 | 
					        dis.dispatch({
 | 
				
			||||||
            action: 'view_room',
 | 
					            action: Action.ViewRoom,
 | 
				
			||||||
            room_alias: this.props.summaryInfo.profile.canonical_alias,
 | 
					            room_alias: this.props.summaryInfo.profile.canonical_alias,
 | 
				
			||||||
            room_id: this.props.summaryInfo.room_id,
 | 
					            room_id: this.props.summaryInfo.room_id,
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -676,7 +676,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
 | 
				
			|||||||
            case 'view_user_info':
 | 
					            case 'view_user_info':
 | 
				
			||||||
                this.viewUser(payload.userId, payload.subAction);
 | 
					                this.viewUser(payload.userId, payload.subAction);
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
            case 'view_room': {
 | 
					            case Action.ViewRoom: {
 | 
				
			||||||
                // Takes either a room ID or room alias: if switching to a room the client is already
 | 
					                // Takes either a room ID or room alias: if switching to a room the client is already
 | 
				
			||||||
                // known to be in (eg. user clicks on a room in the recents panel), supply the ID
 | 
					                // known to be in (eg. user clicks on a room in the recents panel), supply the ID
 | 
				
			||||||
                // If the user is clicking on a room in the context of the alias being presented
 | 
					                // If the user is clicking on a room in the context of the alias being presented
 | 
				
			||||||
@@ -1124,7 +1124,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        if (dmRooms.length > 0) {
 | 
					        if (dmRooms.length > 0) {
 | 
				
			||||||
            dis.dispatch({
 | 
					            dis.dispatch({
 | 
				
			||||||
                action: 'view_room',
 | 
					                action: Action.ViewRoom,
 | 
				
			||||||
                room_id: dmRooms[0],
 | 
					                room_id: dmRooms[0],
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
@@ -1378,7 +1378,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    private viewLastRoom() {
 | 
					    private viewLastRoom() {
 | 
				
			||||||
        dis.dispatch({
 | 
					        dis.dispatch({
 | 
				
			||||||
            action: 'view_room',
 | 
					            action: Action.ViewRoom,
 | 
				
			||||||
            room_id: localStorage.getItem('mx_last_room_id'),
 | 
					            room_id: localStorage.getItem('mx_last_room_id'),
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -1793,7 +1793,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            const payload = {
 | 
					            const payload = {
 | 
				
			||||||
                action: 'view_room',
 | 
					                action: Action.ViewRoom,
 | 
				
			||||||
                event_id: eventId,
 | 
					                event_id: eventId,
 | 
				
			||||||
                via_servers: via,
 | 
					                via_servers: via,
 | 
				
			||||||
                // If an event ID is given in the URL hash, notify RoomViewStore to mark
 | 
					                // If an event ID is given in the URL hash, notify RoomViewStore to mark
 | 
				
			||||||
@@ -1849,7 +1849,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    onAliasClick(event: MouseEvent, alias: string) {
 | 
					    onAliasClick(event: MouseEvent, alias: string) {
 | 
				
			||||||
        event.preventDefault();
 | 
					        event.preventDefault();
 | 
				
			||||||
        dis.dispatch({ action: 'view_room', room_alias: alias });
 | 
					        dis.dispatch({ action: Action.ViewRoom, room_alias: alias });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    onUserClick(event: MouseEvent, userId: string) {
 | 
					    onUserClick(event: MouseEvent, userId: string) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -200,7 +200,7 @@ export default class RightPanel extends React.Component<IProps, IState> {
 | 
				
			|||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private onAction = (payload: ActionPayload) => {
 | 
					    private onAction = (payload: ActionPayload) => {
 | 
				
			||||||
        const isChangingRoom = payload.action === 'view_room' && payload.room_id !== this.props.room.roomId;
 | 
					        const isChangingRoom = payload.action === Action.ViewRoom && payload.room_id !== this.props.room.roomId;
 | 
				
			||||||
        const isViewingThread = this.state.phase === RightPanelPhases.ThreadView;
 | 
					        const isViewingThread = this.state.phase === RightPanelPhases.ThreadView;
 | 
				
			||||||
        if (isChangingRoom && isViewingThread) {
 | 
					        if (isChangingRoom && isViewingThread) {
 | 
				
			||||||
            dispatchShowThreadsPanelEvent();
 | 
					            dispatchShowThreadsPanelEvent();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -49,6 +49,7 @@ import { ActionPayload } from "../../dispatcher/payloads";
 | 
				
			|||||||
import { getDisplayAliasForAliasSet } from "../../Rooms";
 | 
					import { getDisplayAliasForAliasSet } from "../../Rooms";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { logger } from "matrix-js-sdk/src/logger";
 | 
					import { logger } from "matrix-js-sdk/src/logger";
 | 
				
			||||||
 | 
					import { Action } from "../../dispatcher/actions";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const MAX_NAME_LENGTH = 80;
 | 
					const MAX_NAME_LENGTH = 80;
 | 
				
			||||||
const MAX_TOPIC_LENGTH = 800;
 | 
					const MAX_TOPIC_LENGTH = 800;
 | 
				
			||||||
@@ -493,7 +494,7 @@ export default class RoomDirectory extends React.Component<IProps, IState> {
 | 
				
			|||||||
    private showRoom(room: IPublicRoomsChunkRoom, roomAlias?: string, autoJoin = false, shouldPeek = false) {
 | 
					    private showRoom(room: IPublicRoomsChunkRoom, roomAlias?: string, autoJoin = false, shouldPeek = false) {
 | 
				
			||||||
        this.onFinished();
 | 
					        this.onFinished();
 | 
				
			||||||
        const payload: ActionPayload = {
 | 
					        const payload: ActionPayload = {
 | 
				
			||||||
            action: 'view_room',
 | 
					            action: Action.ViewRoom,
 | 
				
			||||||
            auto_join: autoJoin,
 | 
					            auto_join: autoJoin,
 | 
				
			||||||
            should_peek: shouldPeek,
 | 
					            should_peek: shouldPeek,
 | 
				
			||||||
            _type: "room_directory", // instrumentation
 | 
					            _type: "room_directory", // instrumentation
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -94,7 +94,7 @@ export default class RoomSearch extends React.PureComponent<IProps, IState> {
 | 
				
			|||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private onAction = (payload: ActionPayload) => {
 | 
					    private onAction = (payload: ActionPayload) => {
 | 
				
			||||||
        if (payload.action === 'view_room' && payload.clear_search) {
 | 
					        if (payload.action === Action.ViewRoom && payload.clear_search) {
 | 
				
			||||||
            this.clearInput();
 | 
					            this.clearInput();
 | 
				
			||||||
        } else if (payload.action === 'focus_room_filter' && this.inputRef.current) {
 | 
					        } else if (payload.action === 'focus_room_filter' && this.inputRef.current) {
 | 
				
			||||||
            this.inputRef.current.focus();
 | 
					            this.inputRef.current.focus();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -745,7 +745,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
 | 
				
			|||||||
    private onUserScroll = () => {
 | 
					    private onUserScroll = () => {
 | 
				
			||||||
        if (this.state.initialEventId && this.state.isInitialEventHighlighted) {
 | 
					        if (this.state.initialEventId && this.state.isInitialEventHighlighted) {
 | 
				
			||||||
            dis.dispatch({
 | 
					            dis.dispatch({
 | 
				
			||||||
                action: 'view_room',
 | 
					                action: Action.ViewRoom,
 | 
				
			||||||
                room_id: this.state.room.roomId,
 | 
					                room_id: this.state.room.roomId,
 | 
				
			||||||
                event_id: this.state.initialEventId,
 | 
					                event_id: this.state.initialEventId,
 | 
				
			||||||
                highlighted: false,
 | 
					                highlighted: false,
 | 
				
			||||||
@@ -854,7 +854,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                    setImmediate(() => {
 | 
					                    setImmediate(() => {
 | 
				
			||||||
                        dis.dispatch({
 | 
					                        dis.dispatch({
 | 
				
			||||||
                            action: 'view_room',
 | 
					                            action: Action.ViewRoom,
 | 
				
			||||||
                            room_id: roomId,
 | 
					                            room_id: roomId,
 | 
				
			||||||
                            deferred_action: payload,
 | 
					                            deferred_action: payload,
 | 
				
			||||||
                        });
 | 
					                        });
 | 
				
			||||||
@@ -1236,7 +1236,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
 | 
				
			|||||||
            dis.dispatch({
 | 
					            dis.dispatch({
 | 
				
			||||||
                action: 'do_after_sync_prepared',
 | 
					                action: 'do_after_sync_prepared',
 | 
				
			||||||
                deferred_action: {
 | 
					                deferred_action: {
 | 
				
			||||||
                    action: 'view_room',
 | 
					                    action: Action.ViewRoom,
 | 
				
			||||||
                    room_id: this.getRoomId(),
 | 
					                    room_id: this.getRoomId(),
 | 
				
			||||||
                },
 | 
					                },
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
@@ -1612,7 +1612,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
 | 
				
			|||||||
            // an event will take care of both clearing the URL fragment and
 | 
					            // an event will take care of both clearing the URL fragment and
 | 
				
			||||||
            // jumping to the bottom
 | 
					            // jumping to the bottom
 | 
				
			||||||
            dis.dispatch({
 | 
					            dis.dispatch({
 | 
				
			||||||
                action: 'view_room',
 | 
					                action: Action.ViewRoom,
 | 
				
			||||||
                room_id: this.state.room.roomId,
 | 
					                room_id: this.state.room.roomId,
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -22,6 +22,7 @@ import { throttle } from 'lodash';
 | 
				
			|||||||
import AccessibleButton from '../../components/views/elements/AccessibleButton';
 | 
					import AccessibleButton from '../../components/views/elements/AccessibleButton';
 | 
				
			||||||
import classNames from 'classnames';
 | 
					import classNames from 'classnames';
 | 
				
			||||||
import { replaceableComponent } from "../../utils/replaceableComponent";
 | 
					import { replaceableComponent } from "../../utils/replaceableComponent";
 | 
				
			||||||
 | 
					import { Action } from '../../dispatcher/actions';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
interface IProps {
 | 
					interface IProps {
 | 
				
			||||||
    onSearch?: (query: string) => void;
 | 
					    onSearch?: (query: string) => void;
 | 
				
			||||||
@@ -77,7 +78,7 @@ export default class SearchBox extends React.Component<IProps, IState> {
 | 
				
			|||||||
        if (!this.props.enableRoomSearchFocus) return;
 | 
					        if (!this.props.enableRoomSearchFocus) return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        switch (payload.action) {
 | 
					        switch (payload.action) {
 | 
				
			||||||
            case 'view_room':
 | 
					            case Action.ViewRoom:
 | 
				
			||||||
                if (this.search.current && payload.clear_search) {
 | 
					                if (this.search.current && payload.clear_search) {
 | 
				
			||||||
                    this.clearSearch();
 | 
					                    this.clearSearch();
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -175,7 +175,7 @@ export default class ThreadView extends React.Component<IProps, IState> {
 | 
				
			|||||||
    private onScroll = (): void => {
 | 
					    private onScroll = (): void => {
 | 
				
			||||||
        if (this.props.initialEvent && this.props.initialEventHighlighted) {
 | 
					        if (this.props.initialEvent && this.props.initialEventHighlighted) {
 | 
				
			||||||
            dis.dispatch({
 | 
					            dis.dispatch({
 | 
				
			||||||
                action: 'view_room',
 | 
					                action: Action.ViewRoom,
 | 
				
			||||||
                room_id: this.props.room.roomId,
 | 
					                room_id: this.props.room.roomId,
 | 
				
			||||||
                event_id: this.props.initialEvent?.getId(),
 | 
					                event_id: this.props.initialEvent?.getId(),
 | 
				
			||||||
                highlighted: false,
 | 
					                highlighted: false,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -32,6 +32,7 @@ import RoomContext from "../../contexts/RoomContext";
 | 
				
			|||||||
import UserActivity from "../../UserActivity";
 | 
					import UserActivity from "../../UserActivity";
 | 
				
			||||||
import Modal from "../../Modal";
 | 
					import Modal from "../../Modal";
 | 
				
			||||||
import dis from "../../dispatcher/dispatcher";
 | 
					import dis from "../../dispatcher/dispatcher";
 | 
				
			||||||
 | 
					import { Action } from '../../dispatcher/actions';
 | 
				
			||||||
import { Key } from '../../Keyboard';
 | 
					import { Key } from '../../Keyboard';
 | 
				
			||||||
import Timer from '../../utils/Timer';
 | 
					import Timer from '../../utils/Timer';
 | 
				
			||||||
import shouldHideEvent from '../../shouldHideEvent';
 | 
					import shouldHideEvent from '../../shouldHideEvent';
 | 
				
			||||||
@@ -1135,7 +1136,7 @@ class TimelinePanel extends React.Component<IProps, IState> {
 | 
				
			|||||||
                onFinished = () => {
 | 
					                onFinished = () => {
 | 
				
			||||||
                    // go via the dispatcher so that the URL is updated
 | 
					                    // go via the dispatcher so that the URL is updated
 | 
				
			||||||
                    dis.dispatch({
 | 
					                    dis.dispatch({
 | 
				
			||||||
                        action: 'view_room',
 | 
					                        action: Action.ViewRoom,
 | 
				
			||||||
                        room_id: this.props.timelineSet.room.roomId,
 | 
					                        room_id: this.props.timelineSet.room.roomId,
 | 
				
			||||||
                    });
 | 
					                    });
 | 
				
			||||||
                };
 | 
					                };
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -333,7 +333,7 @@ export default class UserMenu extends React.Component<IProps, IState> {
 | 
				
			|||||||
        const chat = CommunityPrototypeStore.instance.getSelectedCommunityGeneralChat();
 | 
					        const chat = CommunityPrototypeStore.instance.getSelectedCommunityGeneralChat();
 | 
				
			||||||
        if (chat) {
 | 
					        if (chat) {
 | 
				
			||||||
            dis.dispatch({
 | 
					            dis.dispatch({
 | 
				
			||||||
                action: 'view_room',
 | 
					                action: Action.ViewRoom,
 | 
				
			||||||
                room_id: chat.roomId,
 | 
					                room_id: chat.roomId,
 | 
				
			||||||
            }, true);
 | 
					            }, true);
 | 
				
			||||||
            dis.dispatch({ action: Action.SetRightPanelPhase, phase: RightPanelPhases.RoomMemberList });
 | 
					            dis.dispatch({ action: Action.SetRightPanelPhase, phase: RightPanelPhases.RoomMemberList });
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -234,7 +234,7 @@ export default class MessageContextMenu extends React.Component<IProps, IState>
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    private viewInRoom = () => {
 | 
					    private viewInRoom = () => {
 | 
				
			||||||
        dis.dispatch({
 | 
					        dis.dispatch({
 | 
				
			||||||
            action: 'view_room',
 | 
					            action: Action.ViewRoom,
 | 
				
			||||||
            event_id: this.props.mxEvent.getId(),
 | 
					            event_id: this.props.mxEvent.getId(),
 | 
				
			||||||
            highlighted: true,
 | 
					            highlighted: true,
 | 
				
			||||||
            room_id: this.props.mxEvent.getRoomId(),
 | 
					            room_id: this.props.mxEvent.getRoomId(),
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -113,7 +113,7 @@ const SpaceContextMenu = ({ space, onFinished, ...props }: IProps) => {
 | 
				
			|||||||
            ev.stopPropagation();
 | 
					            ev.stopPropagation();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            defaultDispatcher.dispatch({
 | 
					            defaultDispatcher.dispatch({
 | 
				
			||||||
                action: 'view_room',
 | 
					                action: Action.ViewRoom,
 | 
				
			||||||
                room_id: space.roomId,
 | 
					                room_id: space.roomId,
 | 
				
			||||||
                forceTimeline: true,
 | 
					                forceTimeline: true,
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -18,6 +18,7 @@ import React, { useCallback, useEffect, useState } from "react";
 | 
				
			|||||||
import { MatrixEvent } from "matrix-js-sdk/src";
 | 
					import { MatrixEvent } from "matrix-js-sdk/src";
 | 
				
			||||||
import { ButtonEvent } from "../elements/AccessibleButton";
 | 
					import { ButtonEvent } from "../elements/AccessibleButton";
 | 
				
			||||||
import dis from '../../../dispatcher/dispatcher';
 | 
					import dis from '../../../dispatcher/dispatcher';
 | 
				
			||||||
 | 
					import { Action } from "../../../dispatcher/actions";
 | 
				
			||||||
import { RoomPermalinkCreator } from "../../../utils/permalinks/Permalinks";
 | 
					import { RoomPermalinkCreator } from "../../../utils/permalinks/Permalinks";
 | 
				
			||||||
import { copyPlaintext } from "../../../utils/strings";
 | 
					import { copyPlaintext } from "../../../utils/strings";
 | 
				
			||||||
import { ChevronFace, ContextMenuTooltipButton } from "../../structures/ContextMenu";
 | 
					import { ChevronFace, ContextMenuTooltipButton } from "../../structures/ContextMenu";
 | 
				
			||||||
@@ -48,7 +49,7 @@ const ThreadListContextMenu: React.FC<IProps> = ({ mxEvent, permalinkCreator, on
 | 
				
			|||||||
        evt.preventDefault();
 | 
					        evt.preventDefault();
 | 
				
			||||||
        evt.stopPropagation();
 | 
					        evt.stopPropagation();
 | 
				
			||||||
        dis.dispatch({
 | 
					        dis.dispatch({
 | 
				
			||||||
            action: 'view_room',
 | 
					            action: Action.ViewRoom,
 | 
				
			||||||
            event_id: mxEvent.getId(),
 | 
					            event_id: mxEvent.getId(),
 | 
				
			||||||
            highlighted: true,
 | 
					            highlighted: true,
 | 
				
			||||||
            room_id: mxEvent.getRoomId(),
 | 
					            room_id: mxEvent.getRoomId(),
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -23,6 +23,7 @@ import AccessibleButton from "../elements/AccessibleButton";
 | 
				
			|||||||
import { MatrixClientPeg } from "../../../MatrixClientPeg";
 | 
					import { MatrixClientPeg } from "../../../MatrixClientPeg";
 | 
				
			||||||
import InfoTooltip from "../elements/InfoTooltip";
 | 
					import InfoTooltip from "../elements/InfoTooltip";
 | 
				
			||||||
import dis from "../../../dispatcher/dispatcher";
 | 
					import dis from "../../../dispatcher/dispatcher";
 | 
				
			||||||
 | 
					import { Action } from '../../../dispatcher/actions';
 | 
				
			||||||
import { showCommunityRoomInviteDialog } from "../../../RoomInvite";
 | 
					import { showCommunityRoomInviteDialog } from "../../../RoomInvite";
 | 
				
			||||||
import GroupStore from "../../../stores/GroupStore";
 | 
					import GroupStore from "../../../stores/GroupStore";
 | 
				
			||||||
import { replaceableComponent } from "../../../utils/replaceableComponent";
 | 
					import { replaceableComponent } from "../../../utils/replaceableComponent";
 | 
				
			||||||
@@ -100,7 +101,7 @@ export default class CreateCommunityPrototypeDialog extends React.PureComponent<
 | 
				
			|||||||
                // Force the group store to update as it might have missed the general chat
 | 
					                // Force the group store to update as it might have missed the general chat
 | 
				
			||||||
                await GroupStore.refreshGroupRooms(result.group_id);
 | 
					                await GroupStore.refreshGroupRooms(result.group_id);
 | 
				
			||||||
                dis.dispatch({
 | 
					                dis.dispatch({
 | 
				
			||||||
                    action: 'view_room',
 | 
					                    action: Action.ViewRoom,
 | 
				
			||||||
                    room_id: result.room_id,
 | 
					                    room_id: result.room_id,
 | 
				
			||||||
                });
 | 
					                });
 | 
				
			||||||
                showCommunityRoomInviteDialog(result.room_id, this.state.name);
 | 
					                showCommunityRoomInviteDialog(result.room_id, this.state.name);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -677,7 +677,7 @@ export default class InviteDialog extends React.PureComponent<IInviteDialogProps
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
        if (existingRoom) {
 | 
					        if (existingRoom) {
 | 
				
			||||||
            dis.dispatch({
 | 
					            dis.dispatch({
 | 
				
			||||||
                action: 'view_room',
 | 
					                action: Action.ViewRoom,
 | 
				
			||||||
                room_id: existingRoom.roomId,
 | 
					                room_id: existingRoom.roomId,
 | 
				
			||||||
                should_peek: false,
 | 
					                should_peek: false,
 | 
				
			||||||
                joining: false,
 | 
					                joining: false,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -29,6 +29,7 @@ import MessageTimestamp from "../messages/MessageTimestamp";
 | 
				
			|||||||
import SettingsStore from "../../../settings/SettingsStore";
 | 
					import SettingsStore from "../../../settings/SettingsStore";
 | 
				
			||||||
import { formatFullDate } from "../../../DateUtils";
 | 
					import { formatFullDate } from "../../../DateUtils";
 | 
				
			||||||
import dis from '../../../dispatcher/dispatcher';
 | 
					import dis from '../../../dispatcher/dispatcher';
 | 
				
			||||||
 | 
					import { Action } from '../../../dispatcher/actions';
 | 
				
			||||||
import { replaceableComponent } from "../../../utils/replaceableComponent";
 | 
					import { replaceableComponent } from "../../../utils/replaceableComponent";
 | 
				
			||||||
import { RoomPermalinkCreator } from "../../../utils/permalinks/Permalinks";
 | 
					import { RoomPermalinkCreator } from "../../../utils/permalinks/Permalinks";
 | 
				
			||||||
import { MatrixEvent } from "matrix-js-sdk/src/models/event";
 | 
					import { MatrixEvent } from "matrix-js-sdk/src/models/event";
 | 
				
			||||||
@@ -332,7 +333,7 @@ export default class ImageView extends React.Component<IProps, IState> {
 | 
				
			|||||||
        // matrix.to, but also for it to enable routing within Element when clicked.
 | 
					        // matrix.to, but also for it to enable routing within Element when clicked.
 | 
				
			||||||
        ev.preventDefault();
 | 
					        ev.preventDefault();
 | 
				
			||||||
        dis.dispatch({
 | 
					        dis.dispatch({
 | 
				
			||||||
            action: 'view_room',
 | 
					            action: Action.ViewRoom,
 | 
				
			||||||
            event_id: this.props.mxEvent.getId(),
 | 
					            event_id: this.props.mxEvent.getId(),
 | 
				
			||||||
            highlighted: true,
 | 
					            highlighted: true,
 | 
				
			||||||
            room_id: this.props.mxEvent.getRoomId(),
 | 
					            room_id: this.props.mxEvent.getRoomId(),
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -18,6 +18,7 @@ limitations under the License.
 | 
				
			|||||||
import React from 'react';
 | 
					import React from 'react';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import dis from '../../../dispatcher/dispatcher';
 | 
					import dis from '../../../dispatcher/dispatcher';
 | 
				
			||||||
 | 
					import { Action } from '../../../dispatcher/actions';
 | 
				
			||||||
import { RoomPermalinkCreator } from '../../../utils/permalinks/Permalinks';
 | 
					import { RoomPermalinkCreator } from '../../../utils/permalinks/Permalinks';
 | 
				
			||||||
import { _t } from '../../../languageHandler';
 | 
					import { _t } from '../../../languageHandler';
 | 
				
			||||||
import { MatrixClientPeg } from '../../../MatrixClientPeg';
 | 
					import { MatrixClientPeg } from '../../../MatrixClientPeg';
 | 
				
			||||||
@@ -38,7 +39,7 @@ export default class RoomCreate extends React.Component<IProps> {
 | 
				
			|||||||
        const predecessor = this.props.mxEvent.getContent()['predecessor'];
 | 
					        const predecessor = this.props.mxEvent.getContent()['predecessor'];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        dis.dispatch({
 | 
					        dis.dispatch({
 | 
				
			||||||
            action: 'view_room',
 | 
					            action: Action.ViewRoom,
 | 
				
			||||||
            event_id: predecessor['event_id'],
 | 
					            event_id: predecessor['event_id'],
 | 
				
			||||||
            highlighted: true,
 | 
					            highlighted: true,
 | 
				
			||||||
            room_id: predecessor['room_id'],
 | 
					            room_id: predecessor['room_id'],
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -126,7 +126,7 @@ async function openDMForUser(matrixClient: MatrixClient, userId: string) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    if (lastActiveRoom) {
 | 
					    if (lastActiveRoom) {
 | 
				
			||||||
        dis.dispatch({
 | 
					        dis.dispatch({
 | 
				
			||||||
            action: 'view_room',
 | 
					            action: Action.ViewRoom,
 | 
				
			||||||
            room_id: lastActiveRoom.roomId,
 | 
					            room_id: lastActiveRoom.roomId,
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
@@ -368,7 +368,7 @@ const UserOptionsSection: React.FC<{
 | 
				
			|||||||
            const onReadReceiptButton = function() {
 | 
					            const onReadReceiptButton = function() {
 | 
				
			||||||
                const room = cli.getRoom(member.roomId);
 | 
					                const room = cli.getRoom(member.roomId);
 | 
				
			||||||
                dis.dispatch({
 | 
					                dis.dispatch({
 | 
				
			||||||
                    action: 'view_room',
 | 
					                    action: Action.ViewRoom,
 | 
				
			||||||
                    highlighted: true,
 | 
					                    highlighted: true,
 | 
				
			||||||
                    event_id: room.getEventReadUpTo(member.userId),
 | 
					                    event_id: room.getEventReadUpTo(member.userId),
 | 
				
			||||||
                    room_id: member.roomId,
 | 
					                    room_id: member.roomId,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -919,7 +919,7 @@ export default class EventTile extends React.Component<IProps, IState> {
 | 
				
			|||||||
        // matrix.to, but also for it to enable routing within Element when clicked.
 | 
					        // matrix.to, but also for it to enable routing within Element when clicked.
 | 
				
			||||||
        e.preventDefault();
 | 
					        e.preventDefault();
 | 
				
			||||||
        dis.dispatch({
 | 
					        dis.dispatch({
 | 
				
			||||||
            action: 'view_room',
 | 
					            action: Action.ViewRoom,
 | 
				
			||||||
            event_id: this.props.mxEvent.getId(),
 | 
					            event_id: this.props.mxEvent.getId(),
 | 
				
			||||||
            highlighted: true,
 | 
					            highlighted: true,
 | 
				
			||||||
            room_id: this.props.mxEvent.getRoomId(),
 | 
					            room_id: this.props.mxEvent.getRoomId(),
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -380,7 +380,7 @@ export default class MessageComposer extends React.Component<IProps, IState> {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        const viaServers = [this.state.tombstone.getSender().split(':').slice(1).join(':')];
 | 
					        const viaServers = [this.state.tombstone.getSender().split(':').slice(1).join(':')];
 | 
				
			||||||
        dis.dispatch({
 | 
					        dis.dispatch({
 | 
				
			||||||
            action: 'view_room',
 | 
					            action: Action.ViewRoom,
 | 
				
			||||||
            highlighted: true,
 | 
					            highlighted: true,
 | 
				
			||||||
            event_id: createEventId,
 | 
					            event_id: createEventId,
 | 
				
			||||||
            room_id: replacementRoomId,
 | 
					            room_id: replacementRoomId,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -20,6 +20,7 @@ import { Room } from "matrix-js-sdk/src/models/room";
 | 
				
			|||||||
import { MatrixEvent } from "matrix-js-sdk/src/models/event";
 | 
					import { MatrixEvent } from "matrix-js-sdk/src/models/event";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import dis from "../../../dispatcher/dispatcher";
 | 
					import dis from "../../../dispatcher/dispatcher";
 | 
				
			||||||
 | 
					import { Action } from "../../../dispatcher/actions";
 | 
				
			||||||
import AccessibleButton from "../elements/AccessibleButton";
 | 
					import AccessibleButton from "../elements/AccessibleButton";
 | 
				
			||||||
import MessageEvent from "../messages/MessageEvent";
 | 
					import MessageEvent from "../messages/MessageEvent";
 | 
				
			||||||
import MemberAvatar from "../avatars/MemberAvatar";
 | 
					import MemberAvatar from "../avatars/MemberAvatar";
 | 
				
			||||||
@@ -45,7 +46,7 @@ export default class PinnedEventTile extends React.Component<IProps> {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    private onTileClicked = () => {
 | 
					    private onTileClicked = () => {
 | 
				
			||||||
        dis.dispatch({
 | 
					        dis.dispatch({
 | 
				
			||||||
            action: 'view_room',
 | 
					            action: Action.ViewRoom,
 | 
				
			||||||
            event_id: this.props.event.getId(),
 | 
					            event_id: this.props.event.getId(),
 | 
				
			||||||
            highlighted: true,
 | 
					            highlighted: true,
 | 
				
			||||||
            room_id: this.props.event.getRoomId(),
 | 
					            room_id: this.props.event.getRoomId(),
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -18,6 +18,7 @@ import React, { createRef } from 'react';
 | 
				
			|||||||
import classNames from 'classnames';
 | 
					import classNames from 'classnames';
 | 
				
			||||||
import { _t } from '../../../languageHandler';
 | 
					import { _t } from '../../../languageHandler';
 | 
				
			||||||
import dis from '../../../dispatcher/dispatcher';
 | 
					import dis from '../../../dispatcher/dispatcher';
 | 
				
			||||||
 | 
					import { Action } from '../../../dispatcher/actions';
 | 
				
			||||||
import { MatrixEvent } from "matrix-js-sdk/src/models/event";
 | 
					import { MatrixEvent } from "matrix-js-sdk/src/models/event";
 | 
				
			||||||
import { RoomPermalinkCreator } from '../../../utils/permalinks/Permalinks';
 | 
					import { RoomPermalinkCreator } from '../../../utils/permalinks/Permalinks';
 | 
				
			||||||
import SenderProfile from "../messages/SenderProfile";
 | 
					import SenderProfile from "../messages/SenderProfile";
 | 
				
			||||||
@@ -90,7 +91,7 @@ export default class ReplyTile extends React.PureComponent<IProps> {
 | 
				
			|||||||
                this.props.toggleExpandedQuote();
 | 
					                this.props.toggleExpandedQuote();
 | 
				
			||||||
            } else {
 | 
					            } else {
 | 
				
			||||||
                dis.dispatch({
 | 
					                dis.dispatch({
 | 
				
			||||||
                    action: 'view_room',
 | 
					                    action: Action.ViewRoom,
 | 
				
			||||||
                    event_id: this.props.mxEvent.getId(),
 | 
					                    event_id: this.props.mxEvent.getId(),
 | 
				
			||||||
                    highlighted: true,
 | 
					                    highlighted: true,
 | 
				
			||||||
                    room_id: this.props.mxEvent.getRoomId(),
 | 
					                    room_id: this.props.mxEvent.getRoomId(),
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -18,6 +18,7 @@ import React from 'react';
 | 
				
			|||||||
import { Room } from 'matrix-js-sdk/src';
 | 
					import { Room } from 'matrix-js-sdk/src';
 | 
				
			||||||
import classNames from 'classnames';
 | 
					import classNames from 'classnames';
 | 
				
			||||||
import dis from '../../../dispatcher/dispatcher';
 | 
					import dis from '../../../dispatcher/dispatcher';
 | 
				
			||||||
 | 
					import { Action } from '../../../dispatcher/actions';
 | 
				
			||||||
import { _t } from '../../../languageHandler';
 | 
					import { _t } from '../../../languageHandler';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { replaceableComponent } from "../../../utils/replaceableComponent";
 | 
					import { replaceableComponent } from "../../../utils/replaceableComponent";
 | 
				
			||||||
@@ -39,7 +40,7 @@ export default class RoomDetailList extends React.Component<IProps> {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    private onDetailsClick = (ev: React.MouseEvent, room: Room): void => {
 | 
					    private onDetailsClick = (ev: React.MouseEvent, room: Room): void => {
 | 
				
			||||||
        dis.dispatch({
 | 
					        dis.dispatch({
 | 
				
			||||||
            action: 'view_room',
 | 
					            action: Action.ViewRoom,
 | 
				
			||||||
            room_id: room.roomId,
 | 
					            room_id: room.roomId,
 | 
				
			||||||
            room_alias: room.getCanonicalAlias() || (room.getAltAliases() || [])[0],
 | 
					            room_alias: room.getCanonicalAlias() || (room.getAltAliases() || [])[0],
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -297,7 +297,7 @@ export default class RoomList extends React.PureComponent<IProps, IState> {
 | 
				
			|||||||
            const room = this.getRoomDelta(currentRoomId, viewRoomDeltaPayload.delta, viewRoomDeltaPayload.unread);
 | 
					            const room = this.getRoomDelta(currentRoomId, viewRoomDeltaPayload.delta, viewRoomDeltaPayload.unread);
 | 
				
			||||||
            if (room) {
 | 
					            if (room) {
 | 
				
			||||||
                dis.dispatch({
 | 
					                dis.dispatch({
 | 
				
			||||||
                    action: 'view_room',
 | 
					                    action: Action.ViewRoom,
 | 
				
			||||||
                    room_id: room.roomId,
 | 
					                    room_id: room.roomId,
 | 
				
			||||||
                    show_room_tile: true, // to make sure the room gets scrolled into view
 | 
					                    show_room_tile: true, // to make sure the room gets scrolled into view
 | 
				
			||||||
                });
 | 
					                });
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -38,6 +38,7 @@ import { ListAlgorithm, SortAlgorithm } from "../../../stores/room-list/algorith
 | 
				
			|||||||
import { DefaultTagID, TagID } from "../../../stores/room-list/models";
 | 
					import { DefaultTagID, TagID } from "../../../stores/room-list/models";
 | 
				
			||||||
import dis from "../../../dispatcher/dispatcher";
 | 
					import dis from "../../../dispatcher/dispatcher";
 | 
				
			||||||
import defaultDispatcher from "../../../dispatcher/dispatcher";
 | 
					import defaultDispatcher from "../../../dispatcher/dispatcher";
 | 
				
			||||||
 | 
					import { Action } from "../../../dispatcher/actions";
 | 
				
			||||||
import NotificationBadge from "./NotificationBadge";
 | 
					import NotificationBadge from "./NotificationBadge";
 | 
				
			||||||
import AccessibleTooltipButton from "../elements/AccessibleTooltipButton";
 | 
					import AccessibleTooltipButton from "../elements/AccessibleTooltipButton";
 | 
				
			||||||
import { Key } from "../../../Keyboard";
 | 
					import { Key } from "../../../Keyboard";
 | 
				
			||||||
@@ -444,7 +445,7 @@ export default class RoomSublist extends React.Component<IProps, IState> {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        if (room) {
 | 
					        if (room) {
 | 
				
			||||||
            dis.dispatch({
 | 
					            dis.dispatch({
 | 
				
			||||||
                action: 'view_room',
 | 
					                action: Action.ViewRoom,
 | 
				
			||||||
                room_id: room.roomId,
 | 
					                room_id: room.roomId,
 | 
				
			||||||
                show_room_tile: true, // to make sure the room gets scrolled into view
 | 
					                show_room_tile: true, // to make sure the room gets scrolled into view
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -22,6 +22,7 @@ import { RovingTabIndexWrapper } from "../../../accessibility/RovingTabIndex";
 | 
				
			|||||||
import AccessibleButton, { ButtonEvent } from "../../views/elements/AccessibleButton";
 | 
					import AccessibleButton, { ButtonEvent } from "../../views/elements/AccessibleButton";
 | 
				
			||||||
import dis from '../../../dispatcher/dispatcher';
 | 
					import dis from '../../../dispatcher/dispatcher';
 | 
				
			||||||
import defaultDispatcher from '../../../dispatcher/dispatcher';
 | 
					import defaultDispatcher from '../../../dispatcher/dispatcher';
 | 
				
			||||||
 | 
					import { Action } from "../../../dispatcher/actions";
 | 
				
			||||||
import { Key } from "../../../Keyboard";
 | 
					import { Key } from "../../../Keyboard";
 | 
				
			||||||
import ActiveRoomObserver from "../../../ActiveRoomObserver";
 | 
					import ActiveRoomObserver from "../../../ActiveRoomObserver";
 | 
				
			||||||
import { _t } from "../../../languageHandler";
 | 
					import { _t } from "../../../languageHandler";
 | 
				
			||||||
@@ -235,7 +236,7 @@ export default class RoomTile extends React.PureComponent<IProps, IState> {
 | 
				
			|||||||
        ev.preventDefault();
 | 
					        ev.preventDefault();
 | 
				
			||||||
        ev.stopPropagation();
 | 
					        ev.stopPropagation();
 | 
				
			||||||
        dis.dispatch({
 | 
					        dis.dispatch({
 | 
				
			||||||
            action: 'view_room',
 | 
					            action: Action.ViewRoom,
 | 
				
			||||||
            show_room_tile: true, // make sure the room is visible in the list
 | 
					            show_room_tile: true, // make sure the room is visible in the list
 | 
				
			||||||
            room_id: this.props.room.roomId,
 | 
					            room_id: this.props.room.roomId,
 | 
				
			||||||
            clear_search: (ev && (ev.key === Key.ENTER || ev.key === Key.SPACE)),
 | 
					            clear_search: (ev && (ev.key === Key.ENTER || ev.key === Key.SPACE)),
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -24,6 +24,7 @@ import RoomUpgradeDialog from "../../../dialogs/RoomUpgradeDialog";
 | 
				
			|||||||
import DevtoolsDialog from "../../../dialogs/DevtoolsDialog";
 | 
					import DevtoolsDialog from "../../../dialogs/DevtoolsDialog";
 | 
				
			||||||
import Modal from "../../../../../Modal";
 | 
					import Modal from "../../../../../Modal";
 | 
				
			||||||
import dis from "../../../../../dispatcher/dispatcher";
 | 
					import dis from "../../../../../dispatcher/dispatcher";
 | 
				
			||||||
 | 
					import { Action } from '../../../../../dispatcher/actions';
 | 
				
			||||||
import { replaceableComponent } from "../../../../../utils/replaceableComponent";
 | 
					import { replaceableComponent } from "../../../../../utils/replaceableComponent";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
interface IProps {
 | 
					interface IProps {
 | 
				
			||||||
@@ -89,7 +90,7 @@ export default class AdvancedRoomSettingsTab extends React.Component<IProps, ISt
 | 
				
			|||||||
        e.stopPropagation();
 | 
					        e.stopPropagation();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        dis.dispatch({
 | 
					        dis.dispatch({
 | 
				
			||||||
            action: 'view_room',
 | 
					            action: Action.ViewRoom,
 | 
				
			||||||
            room_id: this.state.oldRoomId,
 | 
					            room_id: this.state.oldRoomId,
 | 
				
			||||||
            event_id: this.state.oldEventId,
 | 
					            event_id: this.state.oldEventId,
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -112,7 +112,7 @@ export default class VerificationRequestToast extends React.PureComponent<IProps
 | 
				
			|||||||
        try {
 | 
					        try {
 | 
				
			||||||
            if (request.channel.roomId) {
 | 
					            if (request.channel.roomId) {
 | 
				
			||||||
                dis.dispatch({
 | 
					                dis.dispatch({
 | 
				
			||||||
                    action: 'view_room',
 | 
					                    action: Action.ViewRoom,
 | 
				
			||||||
                    room_id: request.channel.roomId,
 | 
					                    room_id: request.channel.roomId,
 | 
				
			||||||
                    should_peek: false,
 | 
					                    should_peek: false,
 | 
				
			||||||
                });
 | 
					                });
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -20,6 +20,7 @@ import React from 'react';
 | 
				
			|||||||
import { _t, _td } from '../../../../languageHandler';
 | 
					import { _t, _td } from '../../../../languageHandler';
 | 
				
			||||||
import RoomAvatar from '../../avatars/RoomAvatar';
 | 
					import RoomAvatar from '../../avatars/RoomAvatar';
 | 
				
			||||||
import dis from '../../../../dispatcher/dispatcher';
 | 
					import dis from '../../../../dispatcher/dispatcher';
 | 
				
			||||||
 | 
					import { Action } from '../../../../dispatcher/actions';
 | 
				
			||||||
import classNames from 'classnames';
 | 
					import classNames from 'classnames';
 | 
				
			||||||
import AccessibleTooltipButton from '../../elements/AccessibleTooltipButton';
 | 
					import AccessibleTooltipButton from '../../elements/AccessibleTooltipButton';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -44,7 +45,7 @@ const onFullscreenClick = () => {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
const onExpandClick = (roomId: string) => {
 | 
					const onExpandClick = (roomId: string) => {
 | 
				
			||||||
    dis.dispatch({
 | 
					    dis.dispatch({
 | 
				
			||||||
        action: 'view_room',
 | 
					        action: Action.ViewRoom,
 | 
				
			||||||
        room_id: roomId,
 | 
					        room_id: roomId,
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -259,7 +259,7 @@ export default async function createRoom(opts: IOpts): Promise<string | null> {
 | 
				
			|||||||
        // entire thing.
 | 
					        // entire thing.
 | 
				
			||||||
        if (opts.andView) {
 | 
					        if (opts.andView) {
 | 
				
			||||||
            dis.dispatch({
 | 
					            dis.dispatch({
 | 
				
			||||||
                action: 'view_room',
 | 
					                action: Action.ViewRoom,
 | 
				
			||||||
                room_id: roomId,
 | 
					                room_id: roomId,
 | 
				
			||||||
                should_peek: false,
 | 
					                should_peek: false,
 | 
				
			||||||
                // Creating a room will have joined us to the room,
 | 
					                // Creating a room will have joined us to the room,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -87,6 +87,11 @@ export enum Action {
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    UpdateSystemFont = "update_system_font",
 | 
					    UpdateSystemFont = "update_system_font",
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Changes room based on payload parameters.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    ViewRoom = "view_room",
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Changes room based on room list order and payload parameters. Should be used with ViewRoomDeltaPayload.
 | 
					     * Changes room based on room list order and payload parameters. Should be used with ViewRoomDeltaPayload.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -72,7 +72,7 @@ export class BreadcrumbsStore extends AsyncStoreWithClient<IState> {
 | 
				
			|||||||
            } else if (settingUpdatedPayload.settingName === 'breadcrumbs') {
 | 
					            } else if (settingUpdatedPayload.settingName === 'breadcrumbs') {
 | 
				
			||||||
                await this.updateState({ enabled: SettingsStore.getValue("breadcrumbs", null) });
 | 
					                await this.updateState({ enabled: SettingsStore.getValue("breadcrumbs", null) });
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        } else if (payload.action === 'view_room') {
 | 
					        } else if (payload.action === Action.ViewRoom) {
 | 
				
			||||||
            if (payload.auto_join && !this.matrixClient.getRoom(payload.room_id)) {
 | 
					            if (payload.auto_join && !this.matrixClient.getRoom(payload.room_id)) {
 | 
				
			||||||
                // Queue the room instead of pushing it immediately. We're probably just
 | 
					                // Queue the room instead of pushing it immediately. We're probably just
 | 
				
			||||||
                // waiting for a room join to complete.
 | 
					                // waiting for a room join to complete.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -17,6 +17,7 @@ limitations under the License.
 | 
				
			|||||||
import { AsyncStoreWithClient } from "./AsyncStoreWithClient";
 | 
					import { AsyncStoreWithClient } from "./AsyncStoreWithClient";
 | 
				
			||||||
import defaultDispatcher from "../dispatcher/dispatcher";
 | 
					import defaultDispatcher from "../dispatcher/dispatcher";
 | 
				
			||||||
import { ActionPayload } from "../dispatcher/payloads";
 | 
					import { ActionPayload } from "../dispatcher/payloads";
 | 
				
			||||||
 | 
					import { Action } from "../dispatcher/actions";
 | 
				
			||||||
import { Room } from "matrix-js-sdk/src/models/room";
 | 
					import { Room } from "matrix-js-sdk/src/models/room";
 | 
				
			||||||
import { EffectiveMembership, getEffectiveMembership } from "../utils/membership";
 | 
					import { EffectiveMembership, getEffectiveMembership } from "../utils/membership";
 | 
				
			||||||
import SettingsStore from "../settings/SettingsStore";
 | 
					import SettingsStore from "../settings/SettingsStore";
 | 
				
			||||||
@@ -149,7 +150,7 @@ export class CommunityPrototypeStore extends AsyncStoreWithClient<IState> {
 | 
				
			|||||||
            const chat = this.getGeneralChat(payload.tag);
 | 
					            const chat = this.getGeneralChat(payload.tag);
 | 
				
			||||||
            if (chat) {
 | 
					            if (chat) {
 | 
				
			||||||
                dis.dispatch({
 | 
					                dis.dispatch({
 | 
				
			||||||
                    action: 'view_room',
 | 
					                    action: Action.ViewRoom,
 | 
				
			||||||
                    room_id: chat.roomId,
 | 
					                    room_id: chat.roomId,
 | 
				
			||||||
                });
 | 
					                });
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -16,6 +16,7 @@ limitations under the License.
 | 
				
			|||||||
import { Store } from 'flux/utils';
 | 
					import { Store } from 'flux/utils';
 | 
				
			||||||
import { EventType } from "matrix-js-sdk/src/@types/event";
 | 
					import { EventType } from "matrix-js-sdk/src/@types/event";
 | 
				
			||||||
import dis from '../dispatcher/dispatcher';
 | 
					import dis from '../dispatcher/dispatcher';
 | 
				
			||||||
 | 
					import { Action } from '../dispatcher/actions';
 | 
				
			||||||
import GroupStore from './GroupStore';
 | 
					import GroupStore from './GroupStore';
 | 
				
			||||||
import Analytics from '../Analytics';
 | 
					import Analytics from '../Analytics';
 | 
				
			||||||
import * as RoomNotifs from "../RoomNotifs";
 | 
					import * as RoomNotifs from "../RoomNotifs";
 | 
				
			||||||
@@ -54,7 +55,7 @@ class GroupFilterOrderStore extends Store {
 | 
				
			|||||||
    __onDispatch(payload) { // eslint-disable-line @typescript-eslint/naming-convention
 | 
					    __onDispatch(payload) { // eslint-disable-line @typescript-eslint/naming-convention
 | 
				
			||||||
        switch (payload.action) {
 | 
					        switch (payload.action) {
 | 
				
			||||||
            // Initialise state after initial sync
 | 
					            // Initialise state after initial sync
 | 
				
			||||||
            case 'view_room': {
 | 
					            case Action.ViewRoom: {
 | 
				
			||||||
                const relatedGroupIds = GroupStore.getGroupIdsForRoomId(payload.room_id);
 | 
					                const relatedGroupIds = GroupStore.getGroupIdsForRoomId(payload.room_id);
 | 
				
			||||||
                this._updateBadges(relatedGroupIds);
 | 
					                this._updateBadges(relatedGroupIds);
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -148,7 +148,7 @@ export default class RightPanelStore extends Store<ActionPayload> {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    __onDispatch(payload: ActionPayload) { // eslint-disable-line @typescript-eslint/naming-convention
 | 
					    __onDispatch(payload: ActionPayload) { // eslint-disable-line @typescript-eslint/naming-convention
 | 
				
			||||||
        switch (payload.action) {
 | 
					        switch (payload.action) {
 | 
				
			||||||
            case 'view_room':
 | 
					            case Action.ViewRoom:
 | 
				
			||||||
                if (payload.room_id === this.lastRoomId) break; // skip this transition, probably a permalink
 | 
					                if (payload.room_id === this.lastRoomId) break; // skip this transition, probably a permalink
 | 
				
			||||||
                // fallthrough
 | 
					                // fallthrough
 | 
				
			||||||
            case 'view_group':
 | 
					            case 'view_group':
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -107,7 +107,7 @@ class RoomViewStore extends Store<ActionPayload> {
 | 
				
			|||||||
            //      - event_id:     '$213456782:matrix.org'
 | 
					            //      - event_id:     '$213456782:matrix.org'
 | 
				
			||||||
            //      - event_offset: 100
 | 
					            //      - event_offset: 100
 | 
				
			||||||
            //      - highlighted:  true
 | 
					            //      - highlighted:  true
 | 
				
			||||||
            case 'view_room':
 | 
					            case Action.ViewRoom:
 | 
				
			||||||
                this.viewRoom(payload);
 | 
					                this.viewRoom(payload);
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
            // for these events blank out the roomId as we are no longer in the RoomView
 | 
					            // for these events blank out the roomId as we are no longer in the RoomView
 | 
				
			||||||
@@ -158,7 +158,7 @@ class RoomViewStore extends Store<ActionPayload> {
 | 
				
			|||||||
                    if (payload.event
 | 
					                    if (payload.event
 | 
				
			||||||
                        && payload.event.getRoomId() !== this.state.roomId) {
 | 
					                        && payload.event.getRoomId() !== this.state.roomId) {
 | 
				
			||||||
                        dis.dispatch({
 | 
					                        dis.dispatch({
 | 
				
			||||||
                            action: 'view_room',
 | 
					                            action: Action.ViewRoom,
 | 
				
			||||||
                            room_id: payload.event.getRoomId(),
 | 
					                            room_id: payload.event.getRoomId(),
 | 
				
			||||||
                            replyingToEvent: payload.event,
 | 
					                            replyingToEvent: payload.event,
 | 
				
			||||||
                        });
 | 
					                        });
 | 
				
			||||||
@@ -251,7 +251,7 @@ class RoomViewStore extends Store<ActionPayload> {
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            dis.dispatch({
 | 
					            dis.dispatch({
 | 
				
			||||||
                action: 'view_room',
 | 
					                action: Action.ViewRoom,
 | 
				
			||||||
                room_id: roomId,
 | 
					                room_id: roomId,
 | 
				
			||||||
                event_id: payload.event_id,
 | 
					                event_id: payload.event_id,
 | 
				
			||||||
                highlighted: payload.highlighted,
 | 
					                highlighted: payload.highlighted,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -45,6 +45,7 @@ import { WidgetType } from "../../widgets/WidgetType";
 | 
				
			|||||||
import ActiveWidgetStore from "../ActiveWidgetStore";
 | 
					import ActiveWidgetStore from "../ActiveWidgetStore";
 | 
				
			||||||
import { objectShallowClone } from "../../utils/objects";
 | 
					import { objectShallowClone } from "../../utils/objects";
 | 
				
			||||||
import defaultDispatcher from "../../dispatcher/dispatcher";
 | 
					import defaultDispatcher from "../../dispatcher/dispatcher";
 | 
				
			||||||
 | 
					import { Action } from "../../dispatcher/actions";
 | 
				
			||||||
import { ElementWidgetActions, IViewRoomApiRequest } from "./ElementWidgetActions";
 | 
					import { ElementWidgetActions, IViewRoomApiRequest } from "./ElementWidgetActions";
 | 
				
			||||||
import { ModalWidgetStore } from "../ModalWidgetStore";
 | 
					import { ModalWidgetStore } from "../ModalWidgetStore";
 | 
				
			||||||
import ThemeWatcher from "../../settings/watchers/ThemeWatcher";
 | 
					import ThemeWatcher from "../../settings/watchers/ThemeWatcher";
 | 
				
			||||||
@@ -291,7 +292,7 @@ export class StopGapWidget extends EventEmitter {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            // at this point we can change rooms, so do that
 | 
					            // at this point we can change rooms, so do that
 | 
				
			||||||
            defaultDispatcher.dispatch({
 | 
					            defaultDispatcher.dispatch({
 | 
				
			||||||
                action: 'view_room',
 | 
					                action: Action.ViewRoom,
 | 
				
			||||||
                room_id: targetRoomId,
 | 
					                room_id: targetRoomId,
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -178,7 +178,7 @@ describe('CallHandler', () => {
 | 
				
			|||||||
            number: '01818118181',
 | 
					            number: '01818118181',
 | 
				
			||||||
        }, true);
 | 
					        }, true);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        const viewRoomPayload = await untilDispatch('view_room');
 | 
					        const viewRoomPayload = await untilDispatch(Action.ViewRoom);
 | 
				
			||||||
        expect(viewRoomPayload.room_id).toEqual(MAPPED_ROOM_ID);
 | 
					        expect(viewRoomPayload.room_id).toEqual(MAPPED_ROOM_ID);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Check that a call was started
 | 
					        // Check that a call was started
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,5 @@
 | 
				
			|||||||
import RoomViewStore from '../../src/stores/RoomViewStore';
 | 
					import RoomViewStore from '../../src/stores/RoomViewStore';
 | 
				
			||||||
 | 
					import { Action } from '../../src/dispatcher/actions';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { MatrixClientPeg as peg } from '../../src/MatrixClientPeg';
 | 
					import { MatrixClientPeg as peg } from '../../src/MatrixClientPeg';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -21,7 +22,7 @@ describe('RoomViewStore', function() {
 | 
				
			|||||||
            done();
 | 
					            done();
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        dispatch({ action: 'view_room', room_id: '!randomcharacters:aser.ver' });
 | 
					        dispatch({ action: Action.ViewRoom, room_id: '!randomcharacters:aser.ver' });
 | 
				
			||||||
        dispatch({ action: 'join_room' });
 | 
					        dispatch({ action: 'join_room' });
 | 
				
			||||||
        expect(RoomViewStore.isJoining()).toBe(true);
 | 
					        expect(RoomViewStore.isJoining()).toBe(true);
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
@@ -43,6 +44,6 @@ describe('RoomViewStore', function() {
 | 
				
			|||||||
            done();
 | 
					            done();
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        dispatch({ action: 'view_room', room_alias: '#somealias2:aser.ver' });
 | 
					        dispatch({ action: Action.ViewRoom, room_alias: '#somealias2:aser.ver' });
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user