Add stream live view - #34
Open
rockynox wants to merge 2 commits into
Open
Conversation
New admin page (/admin/stream/{id}/live) letting stream owners replay
donation messages received during the current live session:
- Explicit live session: start/stop buttons; stopping deletes the
session's donation history (no multi-live history yet)
- Donations captured in a new stream_donation_history table, polled
from the HelloAsso orders feed with its own continuation token
(30s server cache, 10s client poll, same as other widgets)
- Real-time feed with infinite scroll (keyset pagination on id) and
a 300-row render cap
- Starting a live fast-forwards the cursor so pre-live donations are
not imported
- Simulated donations (test mode) also feed the live view
- Donor pseudo/message escaped at render (Twig auto-escape,
textContent in JS) per SEC-02
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Objectif
Ajoute une vue « Live » côté admin qui affiche en temps réel le fil des dons reçus pendant une session de stream, avec scroll infini vers l'historique.
Ce que ça change
Nouvelle page
/admin/stream/{id}/live🔴 Voir le direct)Endpoints ajoutés (tous derrière
AuthMiddleware)GET /admin/stream/{id}/livePOST /admin/stream/{id}/live/startPOST /admin/stream/{id}/live/stopGET /admin/stream/{id}/live/fetch?since_id=GET /admin/stream/{id}/live/history?before_id=Persistance (
migrations/20-add-stream-live-view.sql)charity_stream:live_started_at,live_continuation_token,live_cache_updated_atstream_donation_history(pagination par curseur surid)Autres
StreamDonationHistoryRepository+ modèleStreamDonationEntrysimulateStreamDonationinsère le don simulé dans l'historique quand un live est en coursWIDGET_CACHE_TTL, 30 s par défaut) pour limiter les appels APISécurité
Tout le contenu venant des donateurs (pseudo, message) est injecté côté client via
textContent, jamaisinnerHTML.Tests
vendor/bin/phpunit→ 43 tests, 108 assertions, OK (mise à jour des constructeurs mockés uniquement — pas de test sur les nouveaux endpoints, cf. review).À faire avant merge
add-stream-live-viewde.github/workflows/php-sandbox.yml(déploiement sandbox temporaire)🤖 Generated with Claude Code