Fix bugs identified by the typescripting
This commit is contained in:
parent
0ae4e7b11d
commit
233e2aa425
4 changed files with 27 additions and 14 deletions
|
@ -107,8 +107,9 @@ export class CommunityPrototypeStore extends AsyncStoreWithClient<IState> {
|
|||
|
||||
const pl = generalChat.currentState.getStateEvents("m.room.power_levels", "");
|
||||
if (!pl) return this.isAdminOf(communityId);
|
||||
const plContent = pl.getContent();
|
||||
|
||||
const invitePl = isNullOrUndefined(pl.invite) ? 50 : Number(pl.invite);
|
||||
const invitePl = isNullOrUndefined(plContent.invite) ? 50 : Number(plContent.invite);
|
||||
return invitePl <= myMember.powerLevel;
|
||||
}
|
||||
|
||||
|
@ -159,10 +160,16 @@ export class CommunityPrototypeStore extends AsyncStoreWithClient<IState> {
|
|||
if (SettingsStore.getValue("feature_communities_v2_prototypes")) {
|
||||
const data = this.matrixClient.getAccountData("im.vector.group_info." + roomId);
|
||||
if (data && data.getContent()) {
|
||||
return {displayName: data.getContent().name, avatarMxc: data.getContent().avatar_url};
|
||||
return {
|
||||
displayName: data.getContent().name,
|
||||
avatarMxc: data.getContent().avatar_url,
|
||||
};
|
||||
}
|
||||
}
|
||||
return {displayName: room.name, avatarMxc: room.avatar_url};
|
||||
return {
|
||||
displayName: room.name,
|
||||
avatarMxc: room.getMxcAvatarUrl(),
|
||||
};
|
||||
}
|
||||
|
||||
protected async onReady(): Promise<any> {
|
||||
|
|
|
@ -133,7 +133,7 @@ export class SpaceStoreClass extends AsyncStoreWithClient<IState> {
|
|||
// if the space being selected is an invite then always view that invite
|
||||
// else if the last viewed room in this space is joined then view that
|
||||
// else view space home or home depending on what is being clicked on
|
||||
if (space?.getMyMembership !== "invite" &&
|
||||
if (space?.getMyMembership() !== "invite" &&
|
||||
this.matrixClient?.getRoom(roomId)?.getMyMembership() === "join"
|
||||
) {
|
||||
defaultDispatcher.dispatch({
|
||||
|
@ -423,8 +423,14 @@ export class SpaceStoreClass extends AsyncStoreWithClient<IState> {
|
|||
parent = this.rootSpaces.find(s => this.spaceFilteredRooms.get(s.roomId)?.has(roomId));
|
||||
}
|
||||
if (!parent) {
|
||||
const parents = Array.from(this.parentMap.get(roomId) || []);
|
||||
parent = parents.find(p => this.matrixClient.getRoom(p));
|
||||
const parentIds = Array.from(this.parentMap.get(roomId) || []);
|
||||
for (const parentId of parentIds) {
|
||||
const room = this.matrixClient.getRoom(parentId);
|
||||
if (room) {
|
||||
parent = room;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// don't trigger a context switch when we are switching a space to match the chosen room
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue