feat: [#53] add test message button for matrix hooks #54

Merged
forgejo-bot merged 3 commits from enhancement/53_send_test_message into main 2026-10-13 15:30:05 +00:00
Owner

Problem

Beim Anlegen oder Bearbeiten eines Matrix-Hooks gibt es keine Möglichkeit zu prüfen, ob die Zustellung in den Room wirklich funktioniert – ein kaputter Login oder ein falscher Room fällt erst beim ersten echten Event auf.

Lösung

„Raum testen“-Button hinter dem Raum-Adress-Feld (New + Edit, identisch):

  • Der Test schickt eine als Test gekennzeichnete Nachricht in den Room und meldet das Ergebnis als Toast – ohne Seiten-Reload, die Form-Eingaben bleiben unberührt
  • Es wird immer der aktuell im Formular stehende Raum getestet, nicht der gespeicherte Hook – auch ungespeicherte Änderungen und komplett neue Hooks sind testbar
  • Klick → Stimulus-Controller liest room_id + matrix_login_id aus dem Formular → GET auf die Collection-Route → Turbo-Stream-Antwort appended den Toast in den Notifications-Container
  • Hook#send_test_message nutzt den normalen Zustellpfad (inkl. Token-Refresh), rescuet Messaging::Matrix::Error mit Warn-Log + Sentry-Report inkl. Login/Room-Kontext

Infrastruktur nebenbei

  • Views::TurboStream-Basisklasse mit deklarativer target/action-DSL – jeder künftige Stream-View ist ein Dreizeiler (Backport-Kandidat für die Base-App)
  • PhlexRenderer rendert Views::TurboStream-Instanzen generisch als Turbo-Stream; Naming-Schema: Variant concatenated (IndexMention), andere Formate im Modul (Action::TurboStream)
  • Layout::Notification (einzelne Toast-Card) und Layout::Notifications (Container, id="notifications") getrennt – Flash und Stream-Toast teeln sich dasselbe Markup

Tests

  • Turbo-Stream-Toast (Erfolg/Fehler) mit korrekter Stream-Struktur
  • Zustellung ohne Turbo
  • Fremd-Logins werden abgewiesen

Closes #53

## Problem Beim Anlegen oder Bearbeiten eines Matrix-Hooks gibt es keine Möglichkeit zu prüfen, ob die Zustellung in den Room wirklich funktioniert – ein kaputter Login oder ein falscher Room fällt erst beim ersten echten Event auf. ## Lösung **„Raum testen“-Button hinter dem Raum-Adress-Feld** (New + Edit, identisch): - Der Test schickt eine als Test gekennzeichnete Nachricht in den Room und meldet das Ergebnis als Toast – ohne Seiten-Reload, die Form-Eingaben bleiben unberührt - **Es wird immer der aktuell im Formular stehende Raum getestet**, nicht der gespeicherte Hook – auch ungespeicherte Änderungen und komplett neue Hooks sind testbar - Klick → Stimulus-Controller liest `room_id` + `matrix_login_id` aus dem Formular → GET auf die Collection-Route → Turbo-Stream-Antwort appended den Toast in den Notifications-Container - `Hook#send_test_message` nutzt den normalen Zustellpfad (inkl. Token-Refresh), rescuet `Messaging::Matrix::Error` mit Warn-Log + Sentry-Report inkl. Login/Room-Kontext ## Infrastruktur nebenbei - **`Views::TurboStream`**-Basisklasse mit deklarativer `target`/`action`-DSL – jeder künftige Stream-View ist ein Dreizeiler (Backport-Kandidat für die Base-App) - **`PhlexRenderer`** rendert `Views::TurboStream`-Instanzen generisch als Turbo-Stream; Naming-Schema: Variant concatenated (`IndexMention`), andere Formate im Modul (`Action::TurboStream`) - **`Layout::Notification`** (einzelne Toast-Card) und **`Layout::Notifications`** (Container, `id="notifications"`) getrennt – Flash und Stream-Toast teeln sich dasselbe Markup ## Tests - Turbo-Stream-Toast (Erfolg/Fehler) mit korrekter Stream-Struktur - Zustellung ohne Turbo - Fremd-Logins werden abgewiesen Closes #53
Adds a "Raum testen" button behind the room_id field so users can verify
login and room delivery while configuring a hook – including unsaved
form values.

- collection route reads room_id + matrix_login_id from the current form
  via a Stimulus controller; the test always targets what is on screen,
  not the persisted hook
- introduces Views::TurboStream base class with declarative target/action
  DSL; PhlexRenderer renders such views generically as turbo streams
- splits the flash into Layout::Notification (single toast card) and
  Layout::Notifications (container with id=notifications) so flash and
  turbo stream toast share the same markup
- Hook#send_test_message reuses the regular delivery path, rescues
  Messaging::Matrix::Error with warn log + Sentry context
fix: repair i18n health after notification rename
Some checks failed
PR Triage / Triage pull request (pull_request) Successful in 0s
CI / Quality / Brakeman (pull_request) Successful in 1m8s
CI / Quality / RuboCop (pull_request) Successful in 1m12s
CI / Quality / Bundler Audit (pull_request) Successful in 1m13s
PR Triage / Triage pull request-1 (pull_request) Successful in 1m0s
CI / Quality (pull_request) Successful in 0s
CI / Tests / Unit (pull_request) Successful in 1m40s
CI / Tests / System (pull_request) Successful in 1m45s
CI / Tests / Coverage (pull_request) Failing after 1m17s
CI / Tests (pull_request) Failing after 0s
CI / Container / Build and push (pull_request) Has been skipped
CI / Container (pull_request) Failing after 0s
CI / Deploy (pull_request) Has been skipped
88d21c1154
- navbar still referenced the removed helpers.flash.icons.warning key,
  now points at components.layout.notification.icons.warning
- the turbo stream toast resolves its i18n scope dynamically, so the
  views.app.matrix.hooks.send_test_message keys are ignored as unused
forgejo-actions changed title from [#53] add test message button for matrix hooks to feat: [#53] add test message button for matrix hooks 2026-10-12 17:32:59 +00:00
forgejo-bot scheduled this pull request to auto merge when all checks succeed 2026-10-12 17:33:06 +00:00
forgejo-bot canceled auto merging this pull request when all checks succeed 2026-10-12 17:33:20 +00:00
forgejo-bot scheduled this pull request to auto merge when all checks succeed 2026-10-12 17:33:20 +00:00
forgejo-bot canceled auto merging this pull request when all checks succeed 2026-10-12 17:33:57 +00:00
forgejo-bot scheduled this pull request to auto merge when all checks succeed 2026-10-12 17:33:58 +00:00
forgejo-bot canceled auto merging this pull request when all checks succeed 2026-10-12 17:34:00 +00:00
forgejo-bot scheduled this pull request to auto merge when all checks succeed 2026-10-12 17:34:00 +00:00
forgejo-bot canceled auto merging this pull request when all checks succeed 2026-10-12 17:34:00 +00:00
forgejo-bot scheduled this pull request to auto merge when all checks succeed 2026-10-12 17:34:00 +00:00

📊 Coverage

Metrik Abdeckung
Zeilen 98.28% (3606/3669)
Branches 83.57% (829/992)
Methoden 98.32% (586/596)

Patch-Coverage: 95.7% (89/93 geänderte Zeilen)

Geänderte Dateien (schwach zuerst)

Datei Patch-Coverage Fehlende Zeilen
app/components/layout/notification.rb 80.95% (17/21) 29-32
app/views/turbo_stream.rb 100.0% (14/14)
app/components/layout/notifications.rb 100.0% (11/11)
app/models/messaging/matrix/hook.rb 100.0% (10/10)
app/views/app/matrix/hooks/new.rb 100.0% (10/10)
app/views/app/matrix/hooks/send_test_message.rb 100.0% (9/9)
app/controllers/app/matrix/hooks_controller.rb 100.0% (6/6)
app/controllers/concerns/phlex_renderer.rb 100.0% (5/5)
app/components/form.rb 100.0% (2/2)
app/policies/messaging/matrix/hook_policy.rb 100.0% (2/2)

Schwächste Dateien im Projekt

Datei Abdeckung
app/components/form/select.rb 75.86%
app/components/layout/notification.rb 80.95%
app/views/app/bank/accounts/index.rb 86.89%
app/controllers/app/matrix/logins_controller.rb 87.5%
app/components/concerns/actionable.rb 88.89%
app/components/layout/sidebar.rb 89.47%
app/components/concerns/inferrable.rb 90.63%
app/models/concerns/has_uuid_v7.rb 90.91%
app/components/users/avatar.rb 91.23%
app/controllers/settings/security/otps_controller.rb 91.67%

🔍 Report im Browser ansehen · 📄 Run-Artifact „coverage-report“

<!-- coverage-report --> ## 📊 Coverage | Metrik | Abdeckung | |---|---| | Zeilen | 98.28% (3606/3669) | | Branches | 83.57% (829/992) | | Methoden | 98.32% (586/596) | **Patch-Coverage**: 95.7% (89/93 geänderte Zeilen) **Geänderte Dateien (schwach zuerst)** | Datei | Patch-Coverage | Fehlende Zeilen | |---|---|---| | app/components/layout/notification.rb | 80.95% (17/21) | 29-32 | | app/views/turbo_stream.rb | 100.0% (14/14) | | | app/components/layout/notifications.rb | 100.0% (11/11) | | | app/models/messaging/matrix/hook.rb | 100.0% (10/10) | | | app/views/app/matrix/hooks/new.rb | 100.0% (10/10) | | | app/views/app/matrix/hooks/send_test_message.rb | 100.0% (9/9) | | | app/controllers/app/matrix/hooks_controller.rb | 100.0% (6/6) | | | app/controllers/concerns/phlex_renderer.rb | 100.0% (5/5) | | | app/components/form.rb | 100.0% (2/2) | | | app/policies/messaging/matrix/hook_policy.rb | 100.0% (2/2) | | **Schwächste Dateien im Projekt** | Datei | Abdeckung | |---|---| | app/components/form/select.rb | 75.86% | | app/components/layout/notification.rb | 80.95% | | app/views/app/bank/accounts/index.rb | 86.89% | | app/controllers/app/matrix/logins_controller.rb | 87.5% | | app/components/concerns/actionable.rb | 88.89% | | app/components/layout/sidebar.rb | 89.47% | | app/components/concerns/inferrable.rb | 90.63% | | app/models/concerns/has_uuid_v7.rb | 90.91% | | app/components/users/avatar.rb | 91.23% | | app/controllers/settings/security/otps_controller.rb | 91.67% | [🔍 Report im Browser ansehen](https://pages.hoppe-dev.eu/hobbypunk-centinel/pr-54/coverage) · [📄 Run-Artifact „coverage-report“](https://code.hoppe-dev.eu/hobbypunk/centinel/actions/runs/2730/artifacts/coverage-report)
chore: remove flash component and update related tests
All checks were successful
PR Triage / Triage pull request-1 (pull_request) Successful in 26s
PR Triage / Triage pull request (pull_request) Successful in 0s
CI / Quality / Bundler Audit (pull_request) Successful in 45s
CI / Quality / RuboCop (pull_request) Successful in 46s
CI / Quality / Brakeman (pull_request) Successful in 47s
CI / Quality (pull_request) Successful in 0s
CI / Tests / Unit (pull_request) Successful in 1m17s
CI / Tests / System (pull_request) Successful in 1m22s
CI / Tests / Coverage (pull_request) Successful in 29s
CI / Tests (pull_request) Successful in 0s
CI / Container / Build and push (pull_request) Successful in 14s
CI / Container (pull_request) Successful in 0s
CI / Deploy (pull_request) Has been skipped
a45698d6a4
---------

Co-Authored-By: opencode (Mistral GLM) <opencode-agent[bot]@hoppe-dev.eu>
forgejo-bot canceled auto merging this pull request when all checks succeed 2026-10-13 15:28:28 +00:00
forgejo-bot scheduled this pull request to auto merge when all checks succeed 2026-10-13 15:28:28 +00:00
forgejo-bot deleted branch enhancement/53_send_test_message 2026-10-13 15:30:05 +00:00
Sign in to join this conversation.
No description provided.