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