Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit f5a40ef

Browse files
committed
updated TagFilterStore
1 parent 4f8b0af commit f5a40ef

File tree

10 files changed

+34
-34
lines changed

10 files changed

+34
-34
lines changed

src/actions/TagOrderActions.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ limitations under the License.
1717

1818
import Analytics from '../Analytics';
1919
import { asyncAction } from './actionCreators';
20-
import TagOrderStore from '../stores/TagOrderStore';
20+
import GroupFilterOrderStore from '../stores/GroupFilterOrderStore';
2121
import { AsyncActionPayload } from "../dispatcher/payloads";
2222
import { MatrixClient } from "matrix-js-sdk/src/client";
2323

2424
export default class TagOrderActions {
2525
/**
2626
* Creates an action thunk that will do an asynchronous request to
27-
* move a tag in TagOrderStore to destinationIx.
27+
* move a tag in GroupFilterOrderStore to destinationIx.
2828
*
2929
* @param {MatrixClient} matrixClient the matrix client to set the
3030
* account data on.
@@ -36,8 +36,8 @@ export default class TagOrderActions {
3636
*/
3737
public static moveTag(matrixClient: MatrixClient, tag: string, destinationIx: number): AsyncActionPayload {
3838
// Only commit tags if the state is ready, i.e. not null
39-
let tags = TagOrderStore.getOrderedTags();
40-
let removedTags = TagOrderStore.getRemovedTagsAccountData() || [];
39+
let tags = GroupFilterOrderStore.getOrderedTags();
40+
let removedTags = GroupFilterOrderStore.getRemovedTagsAccountData() || [];
4141
if (!tags) {
4242
return;
4343
}
@@ -47,7 +47,7 @@ export default class TagOrderActions {
4747

4848
removedTags = removedTags.filter((t) => t !== tag);
4949

50-
const storeId = TagOrderStore.getStoreId();
50+
const storeId = GroupFilterOrderStore.getStoreId();
5151

5252
return asyncAction('TagOrderActions.moveTag', () => {
5353
Analytics.trackEvent('TagOrderActions', 'commitTagOrdering');
@@ -83,8 +83,8 @@ export default class TagOrderActions {
8383
*/
8484
public static removeTag(matrixClient: MatrixClient, tag: string): AsyncActionPayload {
8585
// Don't change tags, just removedTags
86-
const tags = TagOrderStore.getOrderedTags();
87-
const removedTags = TagOrderStore.getRemovedTagsAccountData() || [];
86+
const tags = GroupFilterOrderStore.getOrderedTags();
87+
const removedTags = GroupFilterOrderStore.getRemovedTagsAccountData() || [];
8888

8989
if (removedTags.includes(tag)) {
9090
// Return a thunk that doesn't do anything, we don't even need
@@ -94,7 +94,7 @@ export default class TagOrderActions {
9494

9595
removedTags.push(tag);
9696

97-
const storeId = TagOrderStore.getStoreId();
97+
const storeId = GroupFilterOrderStore.getStoreId();
9898

9999
return asyncAction('TagOrderActions.removeTag', () => {
100100
Analytics.trackEvent('TagOrderActions', 'removeTag');

src/components/structures/GroupFilterPanel.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ limitations under the License.
1616
*/
1717

1818
import React from 'react';
19-
import TagOrderStore from '../../stores/TagOrderStore';
19+
import GroupFilterOrderStore from '../../stores/GroupFilterOrderStore';
2020

2121
import GroupActions from '../../actions/GroupActions';
2222

@@ -44,13 +44,13 @@ class GroupFilterPanel extends React.Component {
4444
this.context.on("Group.myMembership", this._onGroupMyMembership);
4545
this.context.on("sync", this._onClientSync);
4646

47-
this._tagOrderStoreToken = TagOrderStore.addListener(() => {
47+
this._GroupFilterOrderStoreToken = GroupFilterOrderStore.addListener(() => {
4848
if (this.unmounted) {
4949
return;
5050
}
5151
this.setState({
52-
orderedTags: TagOrderStore.getOrderedTags() || [],
53-
selectedTags: TagOrderStore.getSelectedTags(),
52+
orderedTags: GroupFilterOrderStore.getOrderedTags() || [],
53+
selectedTags: GroupFilterOrderStore.getSelectedTags(),
5454
});
5555
});
5656
// This could be done by anything with a matrix client
@@ -61,8 +61,8 @@ class GroupFilterPanel extends React.Component {
6161
this.unmounted = true;
6262
this.context.removeListener("Group.myMembership", this._onGroupMyMembership);
6363
this.context.removeListener("sync", this._onClientSync);
64-
if (this._tagOrderStoreToken) {
65-
this._tagOrderStoreToken.remove();
64+
if (this._GroupFilterOrderStoreToken) {
65+
this._GroupFilterOrderStoreToken.remove();
6666
}
6767
}
6868

src/components/structures/LoggedInView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ class LoggedInView extends React.Component<IProps, IState> {
519519
const draggableId = result.draggableId.split(' ').pop();
520520

521521
// Dispatch synchronously so that the GroupFilterPanel receives an
522-
// optimistic update from TagOrderStore before the previous
522+
// optimistic update from GroupFilterOrderStore before the previous
523523
// state is shown.
524524
dis.dispatch(TagOrderActions.moveTag(
525525
this._matrixClient,

src/components/structures/RoomDirectory.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import Analytics from '../../Analytics';
3030
import {getHttpUriForMxc} from "matrix-js-sdk/src/content-repo";
3131
import {ALL_ROOMS} from "../views/directory/NetworkDropdown";
3232
import SettingsStore from "../../settings/SettingsStore";
33-
import TagOrderStore from "../../stores/TagOrderStore";
33+
import GroupFilterOrderStore from "../../stores/GroupFilterOrderStore";
3434
import GroupStore from "../../stores/GroupStore";
3535
import FlairStore from "../../stores/FlairStore";
3636

@@ -49,7 +49,7 @@ export default class RoomDirectory extends React.Component {
4949
constructor(props) {
5050
super(props);
5151

52-
const selectedCommunityId = TagOrderStore.getSelectedTags()[0];
52+
const selectedCommunityId = GroupFilterOrderStore.getSelectedTags()[0];
5353
this.state = {
5454
publicRooms: [],
5555
loading: true,

src/components/structures/UserMenu.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ import IconizedContextMenu, {
4444
} from "../views/context_menus/IconizedContextMenu";
4545
import { CommunityPrototypeStore } from "../../stores/CommunityPrototypeStore";
4646
import * as fbEmitter from "fbemitter";
47-
import TagOrderStore from "../../stores/TagOrderStore";
47+
import GroupFilterOrderStore from "../../stores/GroupFilterOrderStore";
4848
import { showCommunityInviteDialog } from "../../RoomInvite";
4949
import dis from "../../dispatcher/dispatcher";
5050
import { RightPanelPhases } from "../../stores/RightPanelStorePhases";
@@ -87,7 +87,7 @@ export default class UserMenu extends React.Component<IProps, IState> {
8787
public componentDidMount() {
8888
this.dispatcherRef = defaultDispatcher.register(this.onAction);
8989
this.themeWatcherRef = SettingsStore.watchSetting("theme", null, this.onThemeChanged);
90-
this.tagStoreRef = TagOrderStore.addListener(this.onTagStoreUpdate);
90+
this.tagStoreRef = GroupFilterOrderStore.addListener(this.onTagStoreUpdate);
9191
}
9292

9393
public componentWillUnmount() {

src/components/views/elements/TagTile.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import * as FormattingUtils from '../../../utils/FormattingUtils';
2626

2727
import FlairStore from '../../../stores/FlairStore';
2828
import GroupStore from '../../../stores/GroupStore';
29-
import TagOrderStore from '../../../stores/TagOrderStore';
29+
import GroupFilterOrderStore from '../../../stores/GroupFilterOrderStore';
3030
import MatrixClientContext from "../../../contexts/MatrixClientContext";
3131
import AccessibleButton from "./AccessibleButton";
3232
import SettingsStore from "../../../settings/SettingsStore";
@@ -142,7 +142,7 @@ export default class TagTile extends React.Component {
142142
mx_TagTile_selected_prototype: this.props.selected && isPrototype,
143143
});
144144

145-
const badge = TagOrderStore.getGroupBadge(this.props.tag);
145+
const badge = GroupFilterOrderStore.getGroupBadge(this.props.tag);
146146
let badgeElement;
147147
if (badge && !this.state.hover && !this.props.menuDisplayed) {
148148
const badgeClasses = classNames({

src/components/views/elements/UserTagTile.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ limitations under the License.
1717
import React from "react";
1818
import defaultDispatcher from "../../../dispatcher/dispatcher";
1919
import * as fbEmitter from "fbemitter";
20-
import TagOrderStore from "../../../stores/TagOrderStore";
20+
import GroupFilterOrderStore from "../../../stores/GroupFilterOrderStore";
2121
import AccessibleTooltipButton from "./AccessibleTooltipButton";
2222
import classNames from "classnames";
2323
import { _t } from "../../../languageHandler";
@@ -36,20 +36,20 @@ export default class UserTagTile extends React.PureComponent<IProps, IState> {
3636
super(props);
3737

3838
this.state = {
39-
selected: TagOrderStore.getSelectedTags().length === 0,
39+
selected: GroupFilterOrderStore.getSelectedTags().length === 0,
4040
};
4141
}
4242

4343
public componentDidMount() {
44-
this.tagStoreRef = TagOrderStore.addListener(this.onTagStoreUpdate);
44+
this.tagStoreRef = GroupFilterOrderStore.addListener(this.onTagStoreUpdate);
4545
}
4646

4747
public componentWillUnmount() {
4848
this.tagStoreRef.remove();
4949
}
5050

5151
private onTagStoreUpdate = () => {
52-
const selected = TagOrderStore.getSelectedTags().length === 0;
52+
const selected = GroupFilterOrderStore.getSelectedTags().length === 0;
5353
this.setState({selected});
5454
};
5555

src/stores/CommunityPrototypeStore.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import SettingsStore from "../settings/SettingsStore";
2323
import * as utils from "matrix-js-sdk/src/utils";
2424
import { UPDATE_EVENT } from "./AsyncStore";
2525
import FlairStore from "./FlairStore";
26-
import TagOrderStore from "./TagOrderStore";
26+
import GroupFilterOrderStore from "./GroupFilterOrderStore";
2727
import GroupStore from "./GroupStore";
2828
import dis from "../dispatcher/dispatcher";
2929
import { isNullOrUndefined } from "matrix-js-sdk/src/utils";
@@ -50,7 +50,7 @@ export class CommunityPrototypeStore extends AsyncStoreWithClient<IState> {
5050

5151
public getSelectedCommunityId(): string {
5252
if (SettingsStore.getValue("feature_communities_v2_prototypes")) {
53-
return TagOrderStore.getSelectedTags()[0];
53+
return GroupFilterOrderStore.getSelectedTags()[0];
5454
}
5555
return null; // no selection as far as this function is concerned
5656
}

src/stores/TagOrderStore.js renamed to src/stores/GroupFilterOrderStore.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const INITIAL_STATE = {
3535
/**
3636
* A class for storing application state for ordering tags in the GroupFilterPanel.
3737
*/
38-
class TagOrderStore extends Store {
38+
class GroupFilterOrderStore extends Store {
3939
constructor() {
4040
super(dis);
4141

@@ -268,7 +268,7 @@ class TagOrderStore extends Store {
268268
}
269269
}
270270

271-
if (global.singletonTagOrderStore === undefined) {
272-
global.singletonTagOrderStore = new TagOrderStore();
271+
if (global.singletonGroupFilterOrderStore === undefined) {
272+
global.singletonGroupFilterOrderStore = new GroupFilterOrderStore();
273273
}
274-
export default global.singletonTagOrderStore;
274+
export default global.singletonGroupFilterOrderStore;

src/stores/room-list/TagWatcher.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ limitations under the License.
1515
*/
1616

1717
import { RoomListStoreClass } from "./RoomListStore";
18-
import TagOrderStore from "../TagOrderStore";
18+
import GroupFilterOrderStore from "../GroupFilterOrderStore";
1919
import { CommunityFilterCondition } from "./filters/CommunityFilterCondition";
2020
import { arrayDiff, arrayHasDiff } from "../../utils/arrays";
2121

@@ -26,12 +26,12 @@ export class TagWatcher {
2626
private filters = new Map<string, CommunityFilterCondition>();
2727

2828
constructor(private store: RoomListStoreClass) {
29-
TagOrderStore.addListener(this.onTagsUpdated);
29+
GroupFilterOrderStore.addListener(this.onTagsUpdated);
3030
}
3131

3232
private onTagsUpdated = () => {
3333
const lastTags = Array.from(this.filters.keys());
34-
const newTags = TagOrderStore.getSelectedTags();
34+
const newTags = GroupFilterOrderStore.getSelectedTags();
3535

3636
if (arrayHasDiff(lastTags, newTags)) {
3737
// Selected tags changed, do some filtering

0 commit comments

Comments
 (0)