sexo?
This commit is contained in:
@@ -613,7 +613,13 @@ export default {
|
|||||||
const tmp = { user, tag: isTitleSearch ? _decodedTag : tag, hall, mime, itemid: rawIdOrSlug, strict: strict, userHall: userHallObj || userHallSlug, userHallOwner };
|
const tmp = { user, tag: isTitleSearch ? _decodedTag : tag, hall, mime, itemid: rawIdOrSlug, strict: strict, userHall: userHallObj || userHallSlug, userHallOwner };
|
||||||
|
|
||||||
const effMode = Number(mode ?? 0);
|
const effMode = Number(mode ?? 0);
|
||||||
const modequery = computeBaseMode(mode, ratings, session);
|
const nsflId = parseInt(cfg.nsfl_tag_id, 10) || 3;
|
||||||
|
const itemModeQuery = session
|
||||||
|
? computeBaseMode(mode, ratings, session)
|
||||||
|
: (cfg.websrv.public_nsfw
|
||||||
|
? `not exists (select 1 from tags_assign where item_id = items.id and tag_id = ${nsflId})`
|
||||||
|
: `not exists (select 1 from tags_assign where item_id = items.id and tag_id in (2, ${nsflId}))`
|
||||||
|
);
|
||||||
|
|
||||||
let tagFilter = db``;
|
let tagFilter = db``;
|
||||||
let titleFilter = db``;
|
let titleFilter = db``;
|
||||||
@@ -659,7 +665,7 @@ export default {
|
|||||||
: db`and coalesce(items.visibility, 0) = 0`);
|
: db`and coalesce(items.visibility, 0) = 0`);
|
||||||
|
|
||||||
return db`
|
return db`
|
||||||
${db.unsafe(modequery)}
|
${db.unsafe(itemModeQuery)}
|
||||||
and items.active = true
|
and items.active = true
|
||||||
${visibilityFilter}
|
${visibilityFilter}
|
||||||
and (items.expires_at IS NULL OR items.expires_at > ${Math.floor(Date.now() / 1000)})
|
and (items.expires_at IS NULL OR items.expires_at > ${Math.floor(Date.now() / 1000)})
|
||||||
|
|||||||
@@ -797,19 +797,10 @@ export default router => {
|
|||||||
let guestTagFilter = db``;
|
let guestTagFilter = db``;
|
||||||
if (!session) {
|
if (!session) {
|
||||||
const nsflId = parseInt(cfg.nsfl_tag_id, 10) || 3;
|
const nsflId = parseInt(cfg.nsfl_tag_id, 10) || 3;
|
||||||
const itemRatingTags = await db`SELECT tag_id FROM tags_assign WHERE item_id = ${+id} AND tag_id IN (1, 2, ${nsflId})`;
|
|
||||||
const hasRatingTag = itemRatingTags.length > 0;
|
|
||||||
if (!hasRatingTag && !cfg.websrv.public_untagged) {
|
|
||||||
return res.json({ success: false, msg: 'no items found' });
|
|
||||||
}
|
|
||||||
if (cfg.websrv.public_nsfw) {
|
if (cfg.websrv.public_nsfw) {
|
||||||
guestTagFilter = cfg.websrv.public_untagged
|
guestTagFilter = db`and not exists (select 1 from tags_assign where item_id = items.id and tag_id = ${nsflId})`;
|
||||||
? 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 and tag_id in (1, 2, ${nsflId})))`
|
|
||||||
: db`and id in (select item_id from tags_assign where tag_id in (1, 2))`;
|
|
||||||
} else {
|
} else {
|
||||||
guestTagFilter = cfg.websrv.public_untagged
|
guestTagFilter = db`and not exists (select 1 from tags_assign where item_id = items.id and tag_id in (2, ${nsflId}))`;
|
||||||
? 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 and tag_id in (1, 2, ${nsflId})))`
|
|
||||||
: db`and id in (select item_id from tags_assign where tag_id = 1)`;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user