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:
parent
965539da2d
commit
ae0dba4e87
42 changed files with 81 additions and 58 deletions
|
@ -72,7 +72,7 @@ export class BreadcrumbsStore extends AsyncStoreWithClient<IState> {
|
|||
} else if (settingUpdatedPayload.settingName === 'breadcrumbs') {
|
||||
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)) {
|
||||
// Queue the room instead of pushing it immediately. We're probably just
|
||||
// waiting for a room join to complete.
|
||||
|
|
|
@ -17,6 +17,7 @@ limitations under the License.
|
|||
import { AsyncStoreWithClient } from "./AsyncStoreWithClient";
|
||||
import defaultDispatcher from "../dispatcher/dispatcher";
|
||||
import { ActionPayload } from "../dispatcher/payloads";
|
||||
import { Action } from "../dispatcher/actions";
|
||||
import { Room } from "matrix-js-sdk/src/models/room";
|
||||
import { EffectiveMembership, getEffectiveMembership } from "../utils/membership";
|
||||
import SettingsStore from "../settings/SettingsStore";
|
||||
|
@ -149,7 +150,7 @@ export class CommunityPrototypeStore extends AsyncStoreWithClient<IState> {
|
|||
const chat = this.getGeneralChat(payload.tag);
|
||||
if (chat) {
|
||||
dis.dispatch({
|
||||
action: 'view_room',
|
||||
action: Action.ViewRoom,
|
||||
room_id: chat.roomId,
|
||||
});
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ limitations under the License.
|
|||
import { Store } from 'flux/utils';
|
||||
import { EventType } from "matrix-js-sdk/src/@types/event";
|
||||
import dis from '../dispatcher/dispatcher';
|
||||
import { Action } from '../dispatcher/actions';
|
||||
import GroupStore from './GroupStore';
|
||||
import Analytics from '../Analytics';
|
||||
import * as RoomNotifs from "../RoomNotifs";
|
||||
|
@ -54,7 +55,7 @@ class GroupFilterOrderStore extends Store {
|
|||
__onDispatch(payload) { // eslint-disable-line @typescript-eslint/naming-convention
|
||||
switch (payload.action) {
|
||||
// Initialise state after initial sync
|
||||
case 'view_room': {
|
||||
case Action.ViewRoom: {
|
||||
const relatedGroupIds = GroupStore.getGroupIdsForRoomId(payload.room_id);
|
||||
this._updateBadges(relatedGroupIds);
|
||||
break;
|
||||
|
|
|
@ -148,7 +148,7 @@ export default class RightPanelStore extends Store<ActionPayload> {
|
|||
|
||||
__onDispatch(payload: ActionPayload) { // eslint-disable-line @typescript-eslint/naming-convention
|
||||
switch (payload.action) {
|
||||
case 'view_room':
|
||||
case Action.ViewRoom:
|
||||
if (payload.room_id === this.lastRoomId) break; // skip this transition, probably a permalink
|
||||
// fallthrough
|
||||
case 'view_group':
|
||||
|
|
|
@ -107,7 +107,7 @@ class RoomViewStore extends Store<ActionPayload> {
|
|||
// - event_id: '$213456782:matrix.org'
|
||||
// - event_offset: 100
|
||||
// - highlighted: true
|
||||
case 'view_room':
|
||||
case Action.ViewRoom:
|
||||
this.viewRoom(payload);
|
||||
break;
|
||||
// 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
|
||||
&& payload.event.getRoomId() !== this.state.roomId) {
|
||||
dis.dispatch({
|
||||
action: 'view_room',
|
||||
action: Action.ViewRoom,
|
||||
room_id: payload.event.getRoomId(),
|
||||
replyingToEvent: payload.event,
|
||||
});
|
||||
|
@ -251,7 +251,7 @@ class RoomViewStore extends Store<ActionPayload> {
|
|||
}
|
||||
|
||||
dis.dispatch({
|
||||
action: 'view_room',
|
||||
action: Action.ViewRoom,
|
||||
room_id: roomId,
|
||||
event_id: payload.event_id,
|
||||
highlighted: payload.highlighted,
|
||||
|
|
|
@ -45,6 +45,7 @@ import { WidgetType } from "../../widgets/WidgetType";
|
|||
import ActiveWidgetStore from "../ActiveWidgetStore";
|
||||
import { objectShallowClone } from "../../utils/objects";
|
||||
import defaultDispatcher from "../../dispatcher/dispatcher";
|
||||
import { Action } from "../../dispatcher/actions";
|
||||
import { ElementWidgetActions, IViewRoomApiRequest } from "./ElementWidgetActions";
|
||||
import { ModalWidgetStore } from "../ModalWidgetStore";
|
||||
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
|
||||
defaultDispatcher.dispatch({
|
||||
action: 'view_room',
|
||||
action: Action.ViewRoom,
|
||||
room_id: targetRoomId,
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue