feat: native matrix URI pills for {user}/{room} + major rendering & codebase refactor

This change introduces native `matrix:` URI-based rendering for `{user}` and `{room}` placeholders,
replacing previous plaintext and matrix.to-based links. Users and rooms are now rendered as clickable
pills in supporting clients, with a clean display using display names and room names (no @/# prefixes).

Reporting, moderation, and auto-redaction messages have been updated to use the same rendering logic.
Inspect and event links now also use native `matrix:` URIs for direct in-client navigation.

Internally, URI generation and rendering logic have been unified via central helper functions,
ensuring consistent handling of user IDs, room IDs, aliases, and event IDs.

This commit also includes a broader refactor of the codebase:
- decomposed complex flows (e.g. join handling) into smaller helpers
- moved mutable class-level state to instance-level
- reduced duplicate API calls and redundant logic
- improved overall structure and maintainability

Test coverage has been extended for URI helpers and rendering logic to prevent regressions.

No breaking changes to existing template parameters like `{user_link}` or `{room_link}`.
This commit is contained in:
2026-04-11 20:21:33 +02:00
parent 933865d80c
commit edd3eee178
40 changed files with 474 additions and 382 deletions
Executable → Regular
+6 -4
View File
@@ -69,10 +69,10 @@ invitees: []
# set to {} if you don't care about greetings
greetings:
generic: |
Welcome {user_id}! Please be sure to read the topic for helpful links and information.
Welcome {user}! Please be sure to read the topic for helpful links and information.
Use <a href="https://google.com">Google</a> for all other queries ;)
encrypted: |
welcome {user_id}, this is an encrypted room, so you may not be able to see messages previously sent here. don't be
welcome {user}, this is an encrypted room, so you may not be able to see messages previously sent here. don't be
alarmed.
# which of the above greetings should be used in which rooms? use the exact name of each greeting
@@ -100,7 +100,7 @@ notification_room:
# - {room_link}: clickable matrix.to-compatible link to the room
# - {room_id}: raw room ID
join_notification_message: |
{user_link} ({user_id}) has joined {room_link}.
{user} has joined {room}.
# whether to censor files/messages
# can be boolean (true/false) for all-or-nothing behavior,
@@ -190,8 +190,10 @@ verification_message: |
Please send a message to this chat with the content: "{phrase}"
# prefixes used for the clickable {user} and {room} placeholders in rendered HTML notices.
# set either value to "" for a cleaner look without a visible prefix.
# Base URL for Matrix permalink generation.
# This is used for placeholders such as {user_link} and {room_link}.
# Set this to your own matrix.to-compatible instance if you do not want to use https://matrix.to.
matrix_to_base_url: 'https://matrix.to'
matrix_to_base_url: "https://matrix.to"