fix(chronik): surface REPLY events in Für-dich feed via youParticipated #297

Merged
marcel merged 9 commits from feat/issue-295-you-participated into main 2026-04-21 09:00:25 +02:00
Showing only changes of commit 64058cafc4 - Show all commits

View File

@@ -70,7 +70,8 @@ public interface AuditLogQueryRepository extends JpaRepository<AuditLog, UUID> {
CASE WHEN COUNT(*) > 1 THEN MAX(s.happened_at) ELSE NULL END AS happened_at_until,
COUNT(*)::int AS count,
BOOL_OR(s.kind = 'MENTION_CREATED'
AND s.payload->>'mentionedUserId' = :currentUserId) AS you_mentioned
AND s.payload->>'mentionedUserId' = :currentUserId) AS you_mentioned,
MIN(s.payload::text)::jsonb AS payload
FROM sessions s
GROUP BY s.kind, s.actor_id, s.document_id, s.session_id
)
@@ -89,6 +90,13 @@ public interface AuditLogQueryRepository extends JpaRepository<AuditLog, UUID> {
ag.document_id AS documentId,
ag.happened_at AS happened_at,
ag.you_mentioned AS youMentioned,
-- payload->>'commentId' matches notifications.reference_id per AuditKind.COMMENT_ADDED contract
EXISTS(
SELECT 1 FROM notifications n
WHERE n.type = 'REPLY'
AND n.recipient_id = CAST(:currentUserId AS uuid)
AND n.reference_id = (ag.payload->>'commentId')::uuid
) AS youParticipated,
ag.count AS count,
ag.happened_at_until AS happenedAtUntil
FROM aggregated ag