This commit is contained in:
2026-08-09 02:41:57 +02:00
parent b10ddac6f3
commit 98ee76f61c
3 changed files with 37 additions and 34 deletions
+9 -10
View File
@@ -643,7 +643,6 @@ export default {
where
${itemLookup} and
items.active = true
${!session && getGlobalfilter() ? db`and not exists (select 1 from tags_assign where item_id = items.id and (${db.unsafe(getGlobalfilter())}))` : db``}
limit 1
`;
@@ -692,22 +691,22 @@ export default {
last_viewed = now()
`.catch(e => console.error('Failed to track view:', e));
}
// Guest global filter check if item was filtered out
if (!session && getGlobalfilter() && !actitem) {
const unfilteredItem = await db`
select id from items where ${itemLookup} and active = true limit 1
// Guest global filter check for public items (unlisted items requested by direct link/slug bypass guest rating blocks)
if (!session && getGlobalfilter() && (actitem.visibility || 0) === 0) {
const filteredItem = await db`
select 1 from tags_assign where item_id = ${itemid} and (${db.unsafe(getGlobalfilter())}) limit 1
`;
if (unfilteredItem[0]) {
if (filteredItem.length > 0) {
const hallSlug = hall && typeof hall === 'object' ? hall.slug : hall;
return {
success: false,
message: "Sorry, this post is currently not visible.",
item: {
id: unfilteredItem[0].id,
og_thumbnail: `${cfg.websrv.paths.thumbnails}/${unfilteredItem[0].id}_blur.webp`,
id: itemid,
og_thumbnail: `${cfg.websrv.paths.thumbnails}/${itemid}_blur.webp`,
og_url: hallSlug
? `https://${cfg.main.url.domain}/h/${encodeURIComponent(hallSlug)}/${unfilteredItem[0].id}`
: `https://${cfg.main.url.domain}/${unfilteredItem[0].id}`,
? `https://${cfg.main.url.domain}/h/${encodeURIComponent(hallSlug)}/${itemid}`
: `https://${cfg.main.url.domain}/${itemid}`,
og_description: `Content not visible in current mode`
}
};