hgdf
This commit is contained in:
@@ -755,6 +755,7 @@ export default {
|
|||||||
}
|
}
|
||||||
WHERE ${useTagIdOpt ? db`ta.tag_id = ${tagId}` : db`${db.unsafe(modequery)}`}
|
WHERE ${useTagIdOpt ? db`ta.tag_id = ${tagId}` : db`${db.unsafe(modequery)}`}
|
||||||
AND items.active = true
|
AND items.active = true
|
||||||
|
AND coalesce(items.visibility, 0) = 0
|
||||||
${mimeSQL}
|
${mimeSQL}
|
||||||
${checkFilter ? db`AND filter_ta.tag_id IS NULL` : db``}
|
${checkFilter ? db`AND filter_ta.tag_id IS NULL` : db``}
|
||||||
${excludedTags.length > 0 ? db`and not exists (select 1 from tags_assign where item_id = ta.item_id and tag_id = any(${excludedTags}::int[]))` : db``}
|
${excludedTags.length > 0 ? db`and not exists (select 1 from tags_assign where item_id = ta.item_id and tag_id = any(${excludedTags}::int[]))` : db``}
|
||||||
@@ -1045,6 +1046,7 @@ export default {
|
|||||||
WHERE
|
WHERE
|
||||||
${db.unsafe(modequery)}
|
${db.unsafe(modequery)}
|
||||||
AND items.active = true
|
AND items.active = true
|
||||||
|
AND coalesce(items.visibility, 0) = 0
|
||||||
AND items.title ILIKE ${'%' + titleQuery + '%'}
|
AND items.title ILIKE ${'%' + titleQuery + '%'}
|
||||||
AND items.title IS NOT NULL
|
AND items.title IS NOT NULL
|
||||||
${mimeSQL}
|
${mimeSQL}
|
||||||
@@ -1067,6 +1069,7 @@ export default {
|
|||||||
${db.unsafe(modequery)}
|
${db.unsafe(modequery)}
|
||||||
and "user".user ilike ${user}
|
and "user".user ilike ${user}
|
||||||
and items.active = true
|
and items.active = true
|
||||||
|
and coalesce(items.visibility, 0) = 0
|
||||||
${mimeSQL}
|
${mimeSQL}
|
||||||
${!session && getGlobalfilter() ? db`and not exists (select 1 from tags_assign where item_id = items.id and (${db.unsafe(getGlobalfilter())}))` : db``}
|
${!session && getGlobalfilter() ? db`and not exists (select 1 from tags_assign where item_id = items.id and (${db.unsafe(getGlobalfilter())}))` : db``}
|
||||||
group by items.id
|
group by items.id
|
||||||
@@ -1106,6 +1109,7 @@ export default {
|
|||||||
where
|
where
|
||||||
${db.unsafe(modequery)}
|
${db.unsafe(modequery)}
|
||||||
and items.active = true
|
and items.active = true
|
||||||
|
and coalesce(items.visibility, 0) = 0
|
||||||
${tagFilter}
|
${tagFilter}
|
||||||
${user ? db`and items.username ilike ${user}` : db``}
|
${user ? db`and items.username ilike ${user}` : db``}
|
||||||
${hall ? db`and items.id in (select item_id from halls_assign ha join halls h on h.id = ha.hall_id where h.slug = ${hall})` : db``}
|
${hall ? db`and items.id in (select item_id from halls_assign ha join halls h on h.id = ha.hall_id where h.slug = ${hall})` : db``}
|
||||||
@@ -1128,6 +1132,7 @@ export default {
|
|||||||
${db.unsafe(modequery)}
|
${db.unsafe(modequery)}
|
||||||
and h.slug = ${hall}
|
and h.slug = ${hall}
|
||||||
and items.active = true
|
and items.active = true
|
||||||
|
and coalesce(items.visibility, 0) = 0
|
||||||
${mimeSQL}
|
${mimeSQL}
|
||||||
${!session && getGlobalfilter() ? db`and not exists (select 1 from tags_assign where item_id = items.id and (${db.unsafe(getGlobalfilter())}))` : db``}
|
${!session && getGlobalfilter() ? db`and not exists (select 1 from tags_assign where item_id = items.id and (${db.unsafe(getGlobalfilter())}))` : db``}
|
||||||
${excludedTags.length > 0 ? db`and not exists (select 1 from tags_assign where item_id = items.id and tag_id = any(${excludedTags}::int[]))` : db``}
|
${excludedTags.length > 0 ? db`and not exists (select 1 from tags_assign where item_id = items.id and tag_id = any(${excludedTags}::int[]))` : db``}
|
||||||
@@ -1144,6 +1149,7 @@ export default {
|
|||||||
${db.unsafe(modequery)}
|
${db.unsafe(modequery)}
|
||||||
and uha.hall_id = ${userHallId}
|
and uha.hall_id = ${userHallId}
|
||||||
and items.active = true
|
and items.active = true
|
||||||
|
and coalesce(items.visibility, 0) = 0
|
||||||
${mimeSQL}
|
${mimeSQL}
|
||||||
${excludedTags.length > 0 ? db`and not exists (select 1 from tags_assign where item_id = items.id and tag_id = any(${excludedTags}::int[]))` : db``}
|
${excludedTags.length > 0 ? db`and not exists (select 1 from tags_assign where item_id = items.id and tag_id = any(${excludedTags}::int[]))` : db``}
|
||||||
order by random()
|
order by random()
|
||||||
@@ -1170,6 +1176,7 @@ export default {
|
|||||||
${useTagIdOpt ? db`INNER JOIN tags_assign ta ON ta.item_id = items.id AND ta.tag_id = ${tagId}` : db``}
|
${useTagIdOpt ? db`INNER JOIN tags_assign ta ON ta.item_id = items.id AND ta.tag_id = ${tagId}` : db``}
|
||||||
${checkFilter ? db`LEFT JOIN tags_assign filter_ta ON filter_ta.item_id = items.id AND filter_ta.tag_id IN ${db(nsfpIds)}` : db``}
|
${checkFilter ? db`LEFT JOIN tags_assign filter_ta ON filter_ta.item_id = items.id AND filter_ta.tag_id IN ${db(nsfpIds)}` : db``}
|
||||||
WHERE items.active = true
|
WHERE items.active = true
|
||||||
|
AND coalesce(items.visibility, 0) = 0
|
||||||
${mimeSQL}
|
${mimeSQL}
|
||||||
${checkFilter ? db`AND filter_ta.tag_id IS NULL` : db``}
|
${checkFilter ? db`AND filter_ta.tag_id IS NULL` : db``}
|
||||||
${excludedTags.length > 0 ? db`AND NOT EXISTS (SELECT 1 FROM tags_assign WHERE item_id = items.id AND tag_id = ANY(${excludedTags}::int[]))` : db``}
|
${excludedTags.length > 0 ? db`AND NOT EXISTS (SELECT 1 FROM tags_assign WHERE item_id = items.id AND tag_id = ANY(${excludedTags}::int[]))` : db``}
|
||||||
|
|||||||
@@ -268,6 +268,7 @@ export default (router, tpl) => {
|
|||||||
WHERE
|
WHERE
|
||||||
${db.unsafe(modeQuery)}
|
${db.unsafe(modeQuery)}
|
||||||
AND items.active = true
|
AND items.active = true
|
||||||
|
AND COALESCE(items.visibility, 0) = 0
|
||||||
${excludeSwfSQL}
|
${excludeSwfSQL}
|
||||||
${excludePdfSQL}
|
${excludePdfSQL}
|
||||||
${excludeArchiveSQL}
|
${excludeArchiveSQL}
|
||||||
@@ -292,6 +293,7 @@ export default (router, tpl) => {
|
|||||||
WHERE
|
WHERE
|
||||||
${db.unsafe(modeQuery)}
|
${db.unsafe(modeQuery)}
|
||||||
AND items.active = true
|
AND items.active = true
|
||||||
|
AND COALESCE(items.visibility, 0) = 0
|
||||||
${excludeSwfSQL}
|
${excludeSwfSQL}
|
||||||
${excludePdfSQL}
|
${excludePdfSQL}
|
||||||
${excludeArchiveSQL}
|
${excludeArchiveSQL}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ export default async bot => {
|
|||||||
rows = await db`
|
rows = await db`
|
||||||
select id, mime, username, size
|
select id, mime, username, size
|
||||||
from "items"
|
from "items"
|
||||||
where id >= ${randomId} and active = true
|
where id >= ${randomId} and active = true and coalesce(visibility, 0) = 0
|
||||||
order by id asc
|
order by id asc
|
||||||
limit 1
|
limit 1
|
||||||
`;
|
`;
|
||||||
@@ -43,7 +43,7 @@ export default async bot => {
|
|||||||
rows = await db`
|
rows = await db`
|
||||||
select id, mime, username, size
|
select id, mime, username, size
|
||||||
from "items"
|
from "items"
|
||||||
where active = true
|
where active = true and coalesce(visibility, 0) = 0
|
||||||
order by id asc
|
order by id asc
|
||||||
limit 1
|
limit 1
|
||||||
`;
|
`;
|
||||||
@@ -54,7 +54,7 @@ export default async bot => {
|
|||||||
rows = await db`
|
rows = await db`
|
||||||
select id, mime, username, size
|
select id, mime, username, size
|
||||||
from "items"
|
from "items"
|
||||||
where
|
where active = true and coalesce(visibility, 0) = 0 and
|
||||||
${args.map(a => a.charAt(0) === "!"
|
${args.map(a => a.charAt(0) === "!"
|
||||||
? db`username not ilike ${a.slice(1)}`
|
? db`username not ilike ${a.slice(1)}`
|
||||||
: db`username ilike ${a}`
|
: db`username ilike ${a}`
|
||||||
|
|||||||
Reference in New Issue
Block a user