Use FlairStore's cache for group naming

Turns out GroupStore doesn't really know much.
This commit is contained in:
Travis Ralston 2020-08-28 14:56:59 -06:00
parent e68c4efd0b
commit 90d9d7128d
5 changed files with 34 additions and 10 deletions

View file

@ -38,7 +38,7 @@ import {Action} from "../../../dispatcher/actions";
import {DefaultTagID} from "../../../stores/room-list/models";
import RoomListStore from "../../../stores/room-list/RoomListStore";
import TagOrderStore from "../../../stores/TagOrderStore";
import GroupStore from "../../../stores/GroupStore";
import {CommunityPrototypeStore} from "../../../stores/CommunityPrototypeStore";
// we have a number of types defined from the Matrix spec which can't reasonably be altered here.
/* eslint-disable camelcase */
@ -925,8 +925,7 @@ export default class InviteDialog extends React.PureComponent {
let sectionSubname = null;
if (kind === 'suggestions' && TagOrderStore.getSelectedPrototypeTag()) {
const summary = GroupStore.getSummary(TagOrderStore.getSelectedPrototypeTag());
const communityName = summary?.profile?.name || TagOrderStore.getSelectedPrototypeTag();
const communityName = CommunityPrototypeStore.instance.getCommunityName(TagOrderStore.getSelectedPrototypeTag());
sectionSubname = _t("May include members not in %(communityName)s", {communityName});
}
@ -1099,8 +1098,7 @@ export default class InviteDialog extends React.PureComponent {
}},
);
if (TagOrderStore.getSelectedPrototypeTag()) {
const communityId = TagOrderStore.getSelectedPrototypeTag();
const communityName = GroupStore.getSummary(communityId)?.profile?.name || communityId;
const communityName = CommunityPrototypeStore.instance.getSelectedCommunityName();
helpText = _t(
"Start a conversation with someone using their name, username (like <userId/>) or email address. " +
"This won't invite them to %(communityName)s. To invite someone to %(communityName)s, click " +