hgfd
This commit is contained in:
@@ -503,6 +503,26 @@ export default router => {
|
||||
VALUES (${postid}, ${nextTagId}, ${+req.session.id})
|
||||
`;
|
||||
}
|
||||
|
||||
// Propagate rating to all album sub-items if this is an album
|
||||
const albumCheck = await sql`SELECT id FROM items WHERE id = ${postid} AND is_album = true LIMIT 1`;
|
||||
if (albumCheck.length > 0) {
|
||||
const subItems = await sql`SELECT id FROM album_items WHERE item_id = ${postid}`;
|
||||
for (const sub of subItems) {
|
||||
await sql`
|
||||
DELETE FROM album_items_tags_assign
|
||||
WHERE album_item_id = ${sub.id}
|
||||
AND tag_id IN (1, 2, ${nsflId})
|
||||
`;
|
||||
if (nextTagId > 0) {
|
||||
await sql`
|
||||
INSERT INTO album_items_tags_assign (album_item_id, tag_id, user_id)
|
||||
VALUES (${sub.id}, ${nextTagId}, ${+req.session.id})
|
||||
ON CONFLICT DO NOTHING
|
||||
`;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Automatically generate/verify blurred thumbnail on cycle
|
||||
|
||||
@@ -534,7 +534,9 @@ export default router => {
|
||||
tag_id: effectiveRating ? (effectiveRating === 'sfw' ? 1 : (effectiveRating === 'nsfw' ? 2 : (cfg.nsfl_tag_id || 3))) : 0,
|
||||
is_oc: !!is_oc,
|
||||
slug: itemSlug,
|
||||
visibility: targetVisibility
|
||||
visibility: targetVisibility,
|
||||
is_album: false,
|
||||
album_count: 0
|
||||
})})`;
|
||||
} catch (err) {
|
||||
console.error('[UPLOAD-URL] YouTube new_item notify failed:', err);
|
||||
@@ -869,7 +871,9 @@ export default router => {
|
||||
tag_id: effectiveRating ? (effectiveRating === 'sfw' ? 1 : (effectiveRating === 'nsfw' ? 2 : (cfg.nsfl_tag_id || 3))) : 0,
|
||||
is_oc: !!is_oc,
|
||||
slug: itemSlug,
|
||||
visibility: targetVisibility
|
||||
visibility: targetVisibility,
|
||||
is_album: false,
|
||||
album_count: 0
|
||||
})})`;
|
||||
} catch (err) {
|
||||
console.error('[UPLOAD-URL] new_item notify failed:', err);
|
||||
|
||||
@@ -493,7 +493,9 @@ export default (router) => {
|
||||
username: session.user,
|
||||
display_name: session.display_name || null,
|
||||
tag_id: rating === 'sfw' ? 1 : (rating === 'nsfw' ? 2 : (cfg.nsfl_tag_id || 3)),
|
||||
is_oc: false
|
||||
is_oc: false,
|
||||
is_album: false,
|
||||
album_count: 0
|
||||
})})`;
|
||||
} catch (err) {
|
||||
console.error('[REHOST] new_item notify failed:', err);
|
||||
|
||||
@@ -114,9 +114,12 @@ export default (router, tpl) => {
|
||||
}
|
||||
|
||||
const f0ck = await db`
|
||||
select i.dest, i.mime, i.username, i.id, i.visibility, ta.tag_id
|
||||
select i.dest, i.mime, i.username, i.id, i.visibility, i.is_album, i.album_count,
|
||||
(select ta2.tag_id from tags_assign ta2
|
||||
join tags t2 on t2.id = ta2.tag_id
|
||||
where ta2.item_id = i.id and t2.tag in ('sfw','nsfw','nsfl')
|
||||
limit 1) as tag_id
|
||||
from "items" i
|
||||
left join tags_assign ta on ta.item_id = i.id and ta.tag_id in (1, 2)
|
||||
where i.id = ${id} and i.active = false
|
||||
limit 1
|
||||
`;
|
||||
@@ -217,7 +220,9 @@ export default (router, tpl) => {
|
||||
mime: f0ck[0].mime,
|
||||
username: f0ck[0].username,
|
||||
tag_id: f0ck[0].tag_id,
|
||||
is_oc: !!f0ck[0].is_oc
|
||||
is_oc: !!f0ck[0].is_oc,
|
||||
is_album: !!f0ck[0].is_album,
|
||||
album_count: f0ck[0].album_count || 0
|
||||
})})`;
|
||||
} catch (err) {
|
||||
console.error('[MOD APPROVE] new_item notify failed:', err);
|
||||
|
||||
@@ -463,7 +463,9 @@ export const handleUpload = async (req, res, self) => {
|
||||
tag_id: effectiveRating ? (effectiveRating === 'sfw' ? 1 : (effectiveRating === 'nsfw' ? 2 : (cfg.nsfl_tag_id || 3))) : 0,
|
||||
is_oc: !!is_oc,
|
||||
slug: itemSlug,
|
||||
visibility: targetVisibility
|
||||
visibility: targetVisibility,
|
||||
is_album: false,
|
||||
album_count: 0
|
||||
})})`;
|
||||
} catch (err) {
|
||||
console.error('[UPLOAD] YouTube new_item notify failed:', err);
|
||||
@@ -1227,7 +1229,9 @@ export const handleUpload = async (req, res, self) => {
|
||||
tag_id: effectiveRating ? (effectiveRating === 'sfw' ? 1 : (effectiveRating === 'nsfw' ? 2 : (cfg.nsfl_tag_id || 3))) : 0,
|
||||
is_oc: !!is_oc,
|
||||
slug: itemSlug,
|
||||
visibility: targetVisibility
|
||||
visibility: targetVisibility,
|
||||
is_album: !!is_album,
|
||||
album_count: is_album ? rawFiles.length : 0
|
||||
})})`;
|
||||
} catch (err) {
|
||||
console.error('[UPLOAD] new_item notify failed:', err);
|
||||
|
||||
Reference in New Issue
Block a user