Wire up members button to member view
Ideally this would open up the group members panel, but that's exceedingly difficult. Instead, we switch to the general chat and rename the button to be a bit more helpful.
This commit is contained in:
@@ -24,6 +24,8 @@ import * as utils from "matrix-js-sdk/src/utils";
|
||||
import { UPDATE_EVENT } from "./AsyncStore";
|
||||
import FlairStore from "./FlairStore";
|
||||
import TagOrderStore from "./TagOrderStore";
|
||||
import { MatrixClientPeg } from "../MatrixClientPeg";
|
||||
import GroupStore from "./GroupStore";
|
||||
|
||||
interface IState {
|
||||
// nothing of value - we use account data
|
||||
@@ -54,6 +56,19 @@ export class CommunityPrototypeStore extends AsyncStoreWithClient<IState> {
|
||||
return profile?.name || communityId;
|
||||
}
|
||||
|
||||
public getGeneralChat(communityId: string): Room {
|
||||
const rooms = GroupStore.getGroupRooms(communityId)
|
||||
.map(r => MatrixClientPeg.get().getRoom(r.roomId))
|
||||
.filter(r => !!r);
|
||||
let chat = rooms.find(r => {
|
||||
const idState = r.currentState.getStateEvents("im.vector.general_chat", "");
|
||||
if (!idState || idState.getContent()['groupId'] !== communityId) return false;
|
||||
return true;
|
||||
});
|
||||
if (!chat) chat = rooms[0];
|
||||
return chat; // can be null
|
||||
}
|
||||
|
||||
protected async onAction(payload: ActionPayload): Promise<any> {
|
||||
if (!this.matrixClient || !SettingsStore.getValue("feature_communities_v2_prototypes")) {
|
||||
return;
|
||||
|
||||
@@ -168,6 +168,7 @@ class TagOrderStore extends Store {
|
||||
|
||||
if (!allowMultiple && newTags.length === 1) {
|
||||
// We're in prototype behaviour: select the general chat for the community
|
||||
// XXX: This is duplicated with the CommunityPrototypeStore as a cyclical reference
|
||||
const rooms = GroupStore.getGroupRooms(newTags[0])
|
||||
.map(r => MatrixClientPeg.get().getRoom(r.roomId))
|
||||
.filter(r => !!r);
|
||||
|
||||
Reference in New Issue
Block a user