This commit is contained in:
2026-08-09 02:22:22 +02:00
parent 3179d15b42
commit b10ddac6f3
28 changed files with 689 additions and 66 deletions

View File

@@ -1,6 +1,7 @@
import db from "../sql.mjs";
import f0cklib from "../routeinc/f0cklib.mjs";
import cfg from "../config.mjs";
import { getEnableItemSlugs } from "../settings.mjs";
import lib from "../lib.mjs";
import audit from "../audit.mjs";
import { promises as fs } from "fs";
@@ -208,6 +209,7 @@ export default (router, tpl) => {
let processedComments = mentionsProcessed.map(c => {
return {
...c,
item_slug: getEnableItemSlugs() ? c.item_slug : null,
content: c.content
};
});
@@ -593,7 +595,7 @@ export default (router, tpl) => {
type: 'comment',
id: commentId,
item_id: item_id,
item_slug: itemQuery[0]?.slug || null,
item_slug: (getEnableItemSlugs() && itemQuery[0]?.slug) ? itemQuery[0].slug : null,
parent_id: parent_id || null,
body: notifyBody,
username: req.session.user,
@@ -1030,9 +1032,15 @@ export default (router, tpl) => {
LIMIT ${limit} OFFSET ${offset}
`;
// Normalize item_slug based on getEnableItemSlugs()
const processedCommentsList = comments.map(c => ({
...c,
item_slug: getEnableItemSlugs() ? c.item_slug : null
}));
// Fetch comment file attachments
const filesMap = new Map();
if (comments.length > 0) {
if (processedCommentsList.length > 0) {
const commentIds = comments.map(c => c.id);
try {
const files = await db`