fdsa
This commit is contained in:
@@ -456,7 +456,7 @@
|
||||
},
|
||||
"report": {
|
||||
"title": "Submit Report",
|
||||
"placeholder": "Please provide details for this report (required)...",
|
||||
"placeholder": "",
|
||||
"submit": "Submit"
|
||||
},
|
||||
"account_warning": {
|
||||
|
||||
@@ -2533,7 +2533,8 @@ const f0cklib = {
|
||||
exclude,
|
||||
user_id,
|
||||
is_admin,
|
||||
mime
|
||||
mime,
|
||||
strict = false
|
||||
} = {}) => {
|
||||
if (!tag || !tag.trim()) return { items: [], total: 0 };
|
||||
|
||||
@@ -2561,14 +2562,27 @@ const f0cklib = {
|
||||
: db``;
|
||||
|
||||
const terms = tag.split(',').map(t => t.trim()).filter(Boolean);
|
||||
const tagConditions = terms.map(term => {
|
||||
return db`and items.id in (
|
||||
const isStrict = !!strict || (tag && tag.includes(','));
|
||||
let tagConditions;
|
||||
if (isStrict) {
|
||||
tagConditions = terms.length > 0 ? [db`and items.id in (
|
||||
select ta.item_id
|
||||
from tags_assign ta
|
||||
join tags t on t.id = ta.tag_id
|
||||
where t.normalized like '%' || slugify(${term}) || '%'
|
||||
)`;
|
||||
});
|
||||
where t.normalized = ANY(ARRAY(SELECT slugify(x) FROM unnest(${terms}::text[]) AS x))
|
||||
group by ta.item_id
|
||||
having count(distinct t.normalized) = ${terms.length}
|
||||
)`] : [];
|
||||
} else {
|
||||
tagConditions = terms.map(term => {
|
||||
return db`and items.id in (
|
||||
select ta.item_id
|
||||
from tags_assign ta
|
||||
join tags t on t.id = ta.tag_id
|
||||
where t.normalized like '%' || slugify(${term}) || '%'
|
||||
)`;
|
||||
});
|
||||
}
|
||||
|
||||
const isDesc = String(order).toLowerCase() === 'desc';
|
||||
const sortOrderItems = isDesc ? db`items.id desc` : db`items.id asc`;
|
||||
|
||||
@@ -845,6 +845,8 @@ export default router => {
|
||||
? (req.url.qs.mime || null)
|
||||
: (cookieMime || null);
|
||||
|
||||
const isStrict = req.url.qs?.strict === '1' || req.url.qs?.strict === 'true' || !!req.session?.strict_mode;
|
||||
|
||||
const result = await f0cklib.getTagFeedItems({
|
||||
tag,
|
||||
order,
|
||||
@@ -857,7 +859,8 @@ export default router => {
|
||||
exclude: req.session?.excluded_tags || [],
|
||||
user_id: req.session?.id,
|
||||
is_admin: req.session?.admin,
|
||||
mime
|
||||
mime,
|
||||
strict: isStrict
|
||||
});
|
||||
|
||||
const effectiveOffset = result.offset ?? offset;
|
||||
|
||||
Reference in New Issue
Block a user