null-guard space store getParents relation lookup (#7029)
This commit is contained in:
parent
be0fa6da7b
commit
92df0a35a9
1 changed files with 1 additions and 1 deletions
|
@ -315,7 +315,7 @@ export class SpaceStoreClass extends AsyncStoreWithClient<IState> {
|
||||||
// child relations, as per MSC1772.
|
// child relations, as per MSC1772.
|
||||||
// https://github.com/matrix-org/matrix-doc/blob/main/proposals/1772-groups-as-rooms.md#relationship-between-rooms-and-spaces
|
// https://github.com/matrix-org/matrix-doc/blob/main/proposals/1772-groups-as-rooms.md#relationship-between-rooms-and-spaces
|
||||||
const parent = this.matrixClient.getRoom(ev.getStateKey());
|
const parent = this.matrixClient.getRoom(ev.getStateKey());
|
||||||
const relation = parent.currentState.getStateEvents(EventType.SpaceChild, roomId);
|
const relation = parent?.currentState.getStateEvents(EventType.SpaceChild, roomId);
|
||||||
if (!parent?.currentState.maySendStateEvent(EventType.SpaceChild, userId) ||
|
if (!parent?.currentState.maySendStateEvent(EventType.SpaceChild, userId) ||
|
||||||
// also skip this relation if the parent had this child added but then since removed it
|
// also skip this relation if the parent had this child added but then since removed it
|
||||||
(relation && !Array.isArray(relation.getContent().via))
|
(relation && !Array.isArray(relation.getContent().via))
|
||||||
|
|
Loading…
Reference in a new issue