gfd
This commit is contained in:
@@ -780,17 +780,30 @@ export default router => {
|
||||
});
|
||||
}
|
||||
|
||||
let guestTagFilter = db``;
|
||||
if (!session) {
|
||||
if (cfg.websrv.public_nsfw) {
|
||||
guestTagFilter = cfg.websrv.public_untagged
|
||||
? db`and (id in (select item_id from tags_assign where tag_id in (1, 2)) or not exists (select 1 from tags_assign where item_id = items.id))`
|
||||
: db`and id in (select item_id from tags_assign where tag_id in (1, 2))`;
|
||||
} else {
|
||||
guestTagFilter = cfg.websrv.public_untagged
|
||||
? db`and (id in (select item_id from tags_assign where tag_id = 1) or not exists (select 1 from tags_assign where item_id = items.id))`
|
||||
: db`and id in (select item_id from tags_assign where tag_id = 1)`;
|
||||
}
|
||||
}
|
||||
|
||||
const next = await db`
|
||||
select id
|
||||
from "items"
|
||||
where id > ${+id} and active = true and coalesce(visibility, 0) = 0
|
||||
where id > ${+id} and active = true and coalesce(visibility, 0) = 0 ${guestTagFilter}
|
||||
order by id
|
||||
limit 1
|
||||
`;
|
||||
const prev = await db`
|
||||
select id
|
||||
from "items"
|
||||
where id < ${+id} and active = true and coalesce(visibility, 0) = 0
|
||||
where id < ${+id} and active = true and coalesce(visibility, 0) = 0 ${guestTagFilter}
|
||||
order by id desc
|
||||
limit 1
|
||||
`;
|
||||
|
||||
Reference in New Issue
Block a user