From a92215ccf6c9a455444fab78d9d03d2040496d51 Mon Sep 17 00:00:00 2001 From: soxa <6390896+Soxasora@users.noreply.github.com> Date: Wed, 22 Jan 2025 22:23:21 +0100 Subject: [PATCH] fix: globally pinned items rank in global (#1814) * fix: globally pinned items rank in global; use query to filter global pinned items * cleanup --------- Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com> --- api/resolvers/item.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/api/resolvers/item.js b/api/resolvers/item.js index a2c7ef64..5ff729d3 100644 --- a/api/resolvers/item.js +++ b/api/resolvers/item.js @@ -536,8 +536,8 @@ export default { LEFT JOIN "Sub" ON "Sub"."name" = "Item"."subName" ${joinZapRankPersonalView(me, models)} ${whereClause( - // in "home" (sub undefined), we want to show pinned items (but without the pin icon) - sub ? '"Item"."pinId" IS NULL' : '', + // in home (sub undefined), filter out global pinned items since we inject them later + sub ? '"Item"."pinId" IS NULL' : 'NOT ("Item"."pinId" IS NOT NULL AND "Item"."subName" IS NULL)', '"Item"."deletedAt" IS NULL', '"Item"."parentId" IS NULL', '"Item".outlawed = false', @@ -565,8 +565,8 @@ export default { ${whereClause( subClause(sub, 3, 'Item', me, showNsfw), muteClause(me), - // in "home" (sub undefined), we want to show pinned items (but without the pin icon) - sub ? '"Item"."pinId" IS NULL' : '', + // in home (sub undefined), filter out global pinned items since we inject them later + sub ? '"Item"."pinId" IS NULL' : 'NOT ("Item"."pinId" IS NOT NULL AND "Item"."subName" IS NULL)', '"Item"."deletedAt" IS NULL', '"Item"."parentId" IS NULL', '"Item".bio = false',