Skip to content

Commit

Permalink
handleExternalInvite -> handleExternalMembership.
Browse files Browse the repository at this point in the history
Protections may need access to other events, such as leaving rooms.
  • Loading branch information
Gnuxie committed Jan 31, 2025
1 parent 5379866 commit 1b1fc29
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/Protection/ProtectedRoomsSet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export interface ProtectedRoomsSet {
readonly allProtectedRooms: MatrixRoomID[];
handleTimelineEvent(roomID: StringRoomID, event: RoomEvent): void;
handleEventReport(report: EventReport): void;
handleExternalInvite(roomID: StringRoomID, event: MembershipEvent): void;
handleExternalMembership(roomID: StringRoomID, event: MembershipEvent): void;
isProtectedRoom(roomID: StringRoomID): boolean;
unregisterListeners(): void;
}
Expand Down Expand Up @@ -168,15 +168,15 @@ export class StandardProtectedRoomsSet implements ProtectedRoomsSet {
void Task(protection.handleEventReport(report));
}
}
public handleExternalInvite(
public handleExternalMembership(
roomID: StringRoomID,
event: MembershipEvent
): void {
for (const protection of this.protections.allProtections) {
if (protection.handleExternalInvite === undefined) {
if (protection.handleExternalMembership === undefined) {
continue;
}
protection.handleExternalInvite(roomID, event);
protection.handleExternalMembership(roomID, event);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/Protection/Protection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,11 @@ export interface Protection<TProtectionDescription> {
handlePermissionRequirementsMet?(room: MatrixRoomID): void;

/**
* Handle an invitation to a room that is external to the protected rooms set.
* Handle an invitation, room join, kick, leave etc to a room that is external to the protected rooms set.
* @param roomID The room the invitation is for.
* @param event The invitation event itself.
*/
handleExternalInvite?(roomID: StringRoomID, event: MembershipEvent): void;
handleExternalMembership?(roomID: StringRoomID, event: MembershipEvent): void;

/**
* This can be used to determine who are new to the overall protected rooms
Expand Down

0 comments on commit 1b1fc29

Please sign in to comment.