Run all selected prototype community logic through one store

This commit is contained in:
Travis Ralston 2020-08-31 10:19:05 -06:00
parent 93d67a6689
commit 724e3f6905
8 changed files with 31 additions and 30 deletions

View file

@ -27,7 +27,6 @@ import rate_limited_func from "../../../ratelimitedfunc";
import {MatrixClientPeg} from "../../../MatrixClientPeg";
import * as sdk from "../../../index";
import CallHandler from "../../../CallHandler";
import TagOrderStore from "../../../stores/TagOrderStore";
import {CommunityPrototypeStore} from "../../../stores/CommunityPrototypeStore";
const INITIAL_LOAD_NUM_MEMBERS = 30;
@ -467,12 +466,9 @@ export default createReactClass({
}
let inviteButtonText = _t("Invite to this room");
const communityId = TagOrderStore.getSelectedPrototypeTag();
if (communityId) {
const chat = CommunityPrototypeStore.instance.getGeneralChat(communityId);
if (chat && chat.roomId === this.props.roomId) {
inviteButtonText = _t("Invite to this community");
}
const chat = CommunityPrototypeStore.instance.getSelectedCommunityGeneralChat();
if (chat && chat.roomId === this.props.roomId) {
inviteButtonText = _t("Invite to this community");
}
const AccessibleButton = sdk.getComponent("elements.AccessibleButton");

View file

@ -45,7 +45,7 @@ import { arrayFastClone, arrayHasDiff } from "../../../utils/arrays";
import { objectShallowClone, objectWithOnly } from "../../../utils/objects";
import { IconizedContextMenuOption, IconizedContextMenuOptionList } from "../context_menus/IconizedContextMenu";
import AccessibleButton from "../elements/AccessibleButton";
import TagOrderStore from "../../../stores/TagOrderStore";
import { CommunityPrototypeStore } from "../../../stores/CommunityPrototypeStore";
interface IProps {
onKeyDown: (ev: React.KeyboardEvent) => void;
@ -130,7 +130,7 @@ const TAG_AESTHETICS: {
}}
/>
<IconizedContextMenuOption
label={TagOrderStore.getSelectedPrototypeTag()
label={CommunityPrototypeStore.instance.getSelectedCommunityId()
? _t("Explore community rooms")
: _t("Explore public rooms")}
iconClassName="mx_RoomList_iconExplore"