tidy up code
parent
c915288044
commit
f4f4686270
|
@ -371,12 +371,16 @@ export class SpaceStoreClass extends AsyncStoreWithClient<IState> {
|
|||
return room?.currentState.getStateEvents(EventType.SpaceParent)
|
||||
.map(ev => {
|
||||
const content = ev.getContent();
|
||||
if (!Array.isArray(content?.via)) return;
|
||||
const parent = this.matrixClient.getRoom(ev.getStateKey());
|
||||
if (canonicalOnly && !content?.canonical) return;
|
||||
if (parent.currentState.maySendStateEvent(EventType.SpaceChild, userId)) {
|
||||
return parent;
|
||||
if (Array.isArray(content?.via) && (!canonicalOnly || content?.canonical)) {
|
||||
const parent = this.matrixClient.getRoom(ev.getStateKey());
|
||||
// only respect the relationship if the sender has sufficient permissions in the parent to set
|
||||
// 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
|
||||
if (parent?.currentState.maySendStateEvent(EventType.SpaceChild, userId)) {
|
||||
return parent;
|
||||
}
|
||||
}
|
||||
// else implicit undefined which causes this element to be filtered out
|
||||
})
|
||||
.filter(Boolean) || [];
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue