hotfix: make meCommentsViewedAt fallback to createdAt only if there's not lastCommentAt (#2481)

This commit is contained in:
soxa 2025-09-03 20:18:29 +02:00 committed by GitHub
parent 5c9de4c433
commit 83198e7467
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -181,7 +181,7 @@ export async function itemQueryWithMeta ({ me, models, query, orderBy = '' }, ..
"ThreadSubscription"."itemId" IS NOT NULL AS "meSubscription", "ItemForward"."itemId" IS NOT NULL AS "meForward",
to_jsonb("Sub".*) || jsonb_build_object('meMuteSub', "MuteSub"."userId" IS NOT NULL)
|| jsonb_build_object('meSubscription', "SubSubscription"."userId" IS NOT NULL) as sub,
COALESCE("CommentsViewAt"."last_viewed_at", "Item"."created_at") as "meCommentsViewedAt"
COALESCE("CommentsViewAt"."last_viewed_at", "Item"."lastCommentAt", "Item"."created_at") as "meCommentsViewedAt"
FROM (
${query}
) "Item"