diff --git a/src/actions/TagOrderActions.ts b/src/actions/TagOrderActions.ts index c203172874..021cd11b55 100644 --- a/src/actions/TagOrderActions.ts +++ b/src/actions/TagOrderActions.ts @@ -17,14 +17,14 @@ limitations under the License. import Analytics from '../Analytics'; import { asyncAction } from './actionCreators'; -import TagOrderStore from '../stores/TagOrderStore'; +import GroupFilterOrderStore from '../stores/GroupFilterOrderStore'; import { AsyncActionPayload } from "../dispatcher/payloads"; import { MatrixClient } from "matrix-js-sdk/src/client"; export default class TagOrderActions { /** * Creates an action thunk that will do an asynchronous request to - * move a tag in TagOrderStore to destinationIx. + * move a tag in GroupFilterOrderStore to destinationIx. * * @param {MatrixClient} matrixClient the matrix client to set the * account data on. @@ -36,8 +36,8 @@ export default class TagOrderActions { */ public static moveTag(matrixClient: MatrixClient, tag: string, destinationIx: number): AsyncActionPayload { // Only commit tags if the state is ready, i.e. not null - let tags = TagOrderStore.getOrderedTags(); - let removedTags = TagOrderStore.getRemovedTagsAccountData() || []; + let tags = GroupFilterOrderStore.getOrderedTags(); + let removedTags = GroupFilterOrderStore.getRemovedTagsAccountData() || []; if (!tags) { return; } @@ -47,7 +47,7 @@ export default class TagOrderActions { removedTags = removedTags.filter((t) => t !== tag); - const storeId = TagOrderStore.getStoreId(); + const storeId = GroupFilterOrderStore.getStoreId(); return asyncAction('TagOrderActions.moveTag', () => { Analytics.trackEvent('TagOrderActions', 'commitTagOrdering'); @@ -83,8 +83,8 @@ export default class TagOrderActions { */ public static removeTag(matrixClient: MatrixClient, tag: string): AsyncActionPayload { // Don't change tags, just removedTags - const tags = TagOrderStore.getOrderedTags(); - const removedTags = TagOrderStore.getRemovedTagsAccountData() || []; + const tags = GroupFilterOrderStore.getOrderedTags(); + const removedTags = GroupFilterOrderStore.getRemovedTagsAccountData() || []; if (removedTags.includes(tag)) { // Return a thunk that doesn't do anything, we don't even need @@ -94,7 +94,7 @@ export default class TagOrderActions { removedTags.push(tag); - const storeId = TagOrderStore.getStoreId(); + const storeId = GroupFilterOrderStore.getStoreId(); return asyncAction('TagOrderActions.removeTag', () => { Analytics.trackEvent('TagOrderActions', 'removeTag'); diff --git a/src/components/structures/GroupFilterPanel.js b/src/components/structures/GroupFilterPanel.js index bb88fdbf19..6a436354bc 100644 --- a/src/components/structures/GroupFilterPanel.js +++ b/src/components/structures/GroupFilterPanel.js @@ -16,7 +16,7 @@ limitations under the License. */ import React from 'react'; -import TagOrderStore from '../../stores/TagOrderStore'; +import GroupFilterOrderStore from '../../stores/GroupFilterOrderStore'; import GroupActions from '../../actions/GroupActions'; @@ -44,13 +44,13 @@ class GroupFilterPanel extends React.Component { this.context.on("Group.myMembership", this._onGroupMyMembership); this.context.on("sync", this._onClientSync); - this._tagOrderStoreToken = TagOrderStore.addListener(() => { + this._GroupFilterOrderStoreToken = GroupFilterOrderStore.addListener(() => { if (this.unmounted) { return; } this.setState({ - orderedTags: TagOrderStore.getOrderedTags() || [], - selectedTags: TagOrderStore.getSelectedTags(), + orderedTags: GroupFilterOrderStore.getOrderedTags() || [], + selectedTags: GroupFilterOrderStore.getSelectedTags(), }); }); // This could be done by anything with a matrix client @@ -61,8 +61,8 @@ class GroupFilterPanel extends React.Component { this.unmounted = true; this.context.removeListener("Group.myMembership", this._onGroupMyMembership); this.context.removeListener("sync", this._onClientSync); - if (this._tagOrderStoreToken) { - this._tagOrderStoreToken.remove(); + if (this._GroupFilterOrderStoreToken) { + this._GroupFilterOrderStoreToken.remove(); } } diff --git a/src/components/structures/LoggedInView.tsx b/src/components/structures/LoggedInView.tsx index 266c36b3b3..39467b290e 100644 --- a/src/components/structures/LoggedInView.tsx +++ b/src/components/structures/LoggedInView.tsx @@ -519,7 +519,7 @@ class LoggedInView extends React.Component { const draggableId = result.draggableId.split(' ').pop(); // Dispatch synchronously so that the GroupFilterPanel receives an - // optimistic update from TagOrderStore before the previous + // optimistic update from GroupFilterOrderStore before the previous // state is shown. dis.dispatch(TagOrderActions.moveTag( this._matrixClient, diff --git a/src/components/structures/RoomDirectory.js b/src/components/structures/RoomDirectory.js index df580e8de0..97e1f82a77 100644 --- a/src/components/structures/RoomDirectory.js +++ b/src/components/structures/RoomDirectory.js @@ -30,7 +30,7 @@ import Analytics from '../../Analytics'; import {getHttpUriForMxc} from "matrix-js-sdk/src/content-repo"; import {ALL_ROOMS} from "../views/directory/NetworkDropdown"; import SettingsStore from "../../settings/SettingsStore"; -import TagOrderStore from "../../stores/TagOrderStore"; +import GroupFilterOrderStore from "../../stores/GroupFilterOrderStore"; import GroupStore from "../../stores/GroupStore"; import FlairStore from "../../stores/FlairStore"; @@ -49,7 +49,7 @@ export default class RoomDirectory extends React.Component { constructor(props) { super(props); - const selectedCommunityId = TagOrderStore.getSelectedTags()[0]; + const selectedCommunityId = GroupFilterOrderStore.getSelectedTags()[0]; this.state = { publicRooms: [], loading: true, diff --git a/src/components/structures/UserMenu.tsx b/src/components/structures/UserMenu.tsx index 17523290b9..81d25e6a0c 100644 --- a/src/components/structures/UserMenu.tsx +++ b/src/components/structures/UserMenu.tsx @@ -44,7 +44,7 @@ import IconizedContextMenu, { } from "../views/context_menus/IconizedContextMenu"; import { CommunityPrototypeStore } from "../../stores/CommunityPrototypeStore"; import * as fbEmitter from "fbemitter"; -import TagOrderStore from "../../stores/TagOrderStore"; +import GroupFilterOrderStore from "../../stores/GroupFilterOrderStore"; import { showCommunityInviteDialog } from "../../RoomInvite"; import dis from "../../dispatcher/dispatcher"; import { RightPanelPhases } from "../../stores/RightPanelStorePhases"; @@ -87,7 +87,7 @@ export default class UserMenu extends React.Component { public componentDidMount() { this.dispatcherRef = defaultDispatcher.register(this.onAction); this.themeWatcherRef = SettingsStore.watchSetting("theme", null, this.onThemeChanged); - this.tagStoreRef = TagOrderStore.addListener(this.onTagStoreUpdate); + this.tagStoreRef = GroupFilterOrderStore.addListener(this.onTagStoreUpdate); } public componentWillUnmount() { diff --git a/src/components/views/elements/TagTile.js b/src/components/views/elements/TagTile.js index 95aa7da2f2..6c9a01a840 100644 --- a/src/components/views/elements/TagTile.js +++ b/src/components/views/elements/TagTile.js @@ -26,7 +26,7 @@ import * as FormattingUtils from '../../../utils/FormattingUtils'; import FlairStore from '../../../stores/FlairStore'; import GroupStore from '../../../stores/GroupStore'; -import TagOrderStore from '../../../stores/TagOrderStore'; +import GroupFilterOrderStore from '../../../stores/GroupFilterOrderStore'; import MatrixClientContext from "../../../contexts/MatrixClientContext"; import AccessibleButton from "./AccessibleButton"; import SettingsStore from "../../../settings/SettingsStore"; @@ -142,7 +142,7 @@ export default class TagTile extends React.Component { mx_TagTile_selected_prototype: this.props.selected && isPrototype, }); - const badge = TagOrderStore.getGroupBadge(this.props.tag); + const badge = GroupFilterOrderStore.getGroupBadge(this.props.tag); let badgeElement; if (badge && !this.state.hover && !this.props.menuDisplayed) { const badgeClasses = classNames({ diff --git a/src/components/views/elements/UserTagTile.tsx b/src/components/views/elements/UserTagTile.tsx index 912f54edc7..e7c74bb10e 100644 --- a/src/components/views/elements/UserTagTile.tsx +++ b/src/components/views/elements/UserTagTile.tsx @@ -17,7 +17,7 @@ limitations under the License. import React from "react"; import defaultDispatcher from "../../../dispatcher/dispatcher"; import * as fbEmitter from "fbemitter"; -import TagOrderStore from "../../../stores/TagOrderStore"; +import GroupFilterOrderStore from "../../../stores/GroupFilterOrderStore"; import AccessibleTooltipButton from "./AccessibleTooltipButton"; import classNames from "classnames"; import { _t } from "../../../languageHandler"; @@ -36,12 +36,12 @@ export default class UserTagTile extends React.PureComponent { super(props); this.state = { - selected: TagOrderStore.getSelectedTags().length === 0, + selected: GroupFilterOrderStore.getSelectedTags().length === 0, }; } public componentDidMount() { - this.tagStoreRef = TagOrderStore.addListener(this.onTagStoreUpdate); + this.tagStoreRef = GroupFilterOrderStore.addListener(this.onTagStoreUpdate); } public componentWillUnmount() { @@ -49,7 +49,7 @@ export default class UserTagTile extends React.PureComponent { } private onTagStoreUpdate = () => { - const selected = TagOrderStore.getSelectedTags().length === 0; + const selected = GroupFilterOrderStore.getSelectedTags().length === 0; this.setState({selected}); }; diff --git a/src/stores/CommunityPrototypeStore.ts b/src/stores/CommunityPrototypeStore.ts index 4ff859d4fe..95d56bd40e 100644 --- a/src/stores/CommunityPrototypeStore.ts +++ b/src/stores/CommunityPrototypeStore.ts @@ -23,7 +23,7 @@ import SettingsStore from "../settings/SettingsStore"; import * as utils from "matrix-js-sdk/src/utils"; import { UPDATE_EVENT } from "./AsyncStore"; import FlairStore from "./FlairStore"; -import TagOrderStore from "./TagOrderStore"; +import GroupFilterOrderStore from "./GroupFilterOrderStore"; import GroupStore from "./GroupStore"; import dis from "../dispatcher/dispatcher"; import { isNullOrUndefined } from "matrix-js-sdk/src/utils"; @@ -50,7 +50,7 @@ export class CommunityPrototypeStore extends AsyncStoreWithClient { public getSelectedCommunityId(): string { if (SettingsStore.getValue("feature_communities_v2_prototypes")) { - return TagOrderStore.getSelectedTags()[0]; + return GroupFilterOrderStore.getSelectedTags()[0]; } return null; // no selection as far as this function is concerned } diff --git a/src/stores/TagOrderStore.js b/src/stores/GroupFilterOrderStore.js similarity index 97% rename from src/stores/TagOrderStore.js rename to src/stores/GroupFilterOrderStore.js index 571a34a976..d86a7a3936 100644 --- a/src/stores/TagOrderStore.js +++ b/src/stores/GroupFilterOrderStore.js @@ -35,7 +35,7 @@ const INITIAL_STATE = { /** * A class for storing application state for ordering tags in the GroupFilterPanel. */ -class TagOrderStore extends Store { +class GroupFilterOrderStore extends Store { constructor() { super(dis); @@ -268,7 +268,7 @@ class TagOrderStore extends Store { } } -if (global.singletonTagOrderStore === undefined) { - global.singletonTagOrderStore = new TagOrderStore(); +if (global.singletonGroupFilterOrderStore === undefined) { + global.singletonGroupFilterOrderStore = new GroupFilterOrderStore(); } -export default global.singletonTagOrderStore; +export default global.singletonGroupFilterOrderStore; diff --git a/src/stores/room-list/TagWatcher.ts b/src/stores/room-list/TagWatcher.ts index dc445d10ba..7e809283e9 100644 --- a/src/stores/room-list/TagWatcher.ts +++ b/src/stores/room-list/TagWatcher.ts @@ -15,7 +15,7 @@ limitations under the License. */ import { RoomListStoreClass } from "./RoomListStore"; -import TagOrderStore from "../TagOrderStore"; +import GroupFilterOrderStore from "../GroupFilterOrderStore"; import { CommunityFilterCondition } from "./filters/CommunityFilterCondition"; import { arrayDiff, arrayHasDiff } from "../../utils/arrays"; @@ -26,12 +26,12 @@ export class TagWatcher { private filters = new Map(); constructor(private store: RoomListStoreClass) { - TagOrderStore.addListener(this.onTagsUpdated); + GroupFilterOrderStore.addListener(this.onTagsUpdated); } private onTagsUpdated = () => { const lastTags = Array.from(this.filters.keys()); - const newTags = TagOrderStore.getSelectedTags(); + const newTags = GroupFilterOrderStore.getSelectedTags(); if (arrayHasDiff(lastTags, newTags)) { // Selected tags changed, do some filtering