mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-02-22 21:23:09 +01:00
add get orphan parent util
This commit is contained in:
parent
55ff7e953b
commit
488db6bf63
1 changed files with 14 additions and 0 deletions
|
@ -141,6 +141,20 @@ export const getRoomToParents = (mx: MatrixClient): RoomToParents => {
|
|||
return map;
|
||||
};
|
||||
|
||||
export const getOrphanParent = (
|
||||
roomToParents: RoomToParents,
|
||||
roomId: string
|
||||
): string | undefined => {
|
||||
const parents = getAllParents(roomToParents, roomId);
|
||||
const orphanParents = Array.from(parents).filter(
|
||||
(parentRoomId) => !roomToParents.has(parentRoomId)
|
||||
);
|
||||
|
||||
if (orphanParents.length === 0) return undefined;
|
||||
|
||||
return orphanParents[0];
|
||||
};
|
||||
|
||||
export const isMutedRule = (rule: IPushRule) =>
|
||||
rule.actions[0] === 'dont_notify' && rule.conditions?.[0]?.kind === 'event_match';
|
||||
|
||||
|
|
Loading…
Reference in a new issue