feat(notifications): add leave, kick and ban notifications with actor pills

Extend the notification system to include member leave, kick and ban events,
mirroring the existing join notification functionality.

### Changes
- Added `_handle_leave_notifications` to process LEAVE, KICK and BAN events
- Integrated new notifications into existing membership event handlers
- Introduced `{actor}` placeholder with Matrix URI pill support
- Added `{actor_display}` as plaintext fallback
- Extended template renderer to support actor context
- Ensured consistent rendering across plaintext and HTML messages
- Added template cleanup for cases without an actor (e.g. voluntary leave)

### Templates
New placeholders:
- `{actor}` → clickable Matrix user pill
- `{actor_display}` → plain display name

### Configuration
New config keys:
- `leave_notification_message`
- `kick_notification_message`
- `ban_notification_message`

### Notes
- Fully async and non-blocking implementation
- Backwards compatible with existing templates
- No impact on join notification logic
- Scoped to rooms within configured space
This commit is contained in:
2026-05-08 20:30:01 +02:00
parent 7471da08ce
commit 0ee5f4cb1b
3 changed files with 90 additions and 3 deletions
+10 -1
View File
@@ -91,7 +91,7 @@ welcome_sleep: 0
# (optional)
notification_room:
# message to send to the notification room when someone joins one of the above rooms:
# message to send to the notification room when someone joins or leave one of the above rooms:
# available placeholders:
# - {user}: display name of the joining user (falls back to localpart or user ID)
# - {user_id}: full Matrix user ID
@@ -101,6 +101,15 @@ notification_room:
# - {room_id}: raw room ID
join_notification_message: |
{user} has joined {room}.
leave_notification_message: |
{user} has left {room}.
kick_notification_message: |
{user} was kicked by {actor} from {room}.
ban_notification_message: |
{user} was baned by {actor} from {room}.
# whether to censor files/messages
# can be boolean (true/false) for all-or-nothing behavior,