mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-03-05 03:51:26 +01:00
fix: proper attachment generation on replies, fixed replies getting thumb attachment when it wasn't part of it
This commit is contained in:
@@ -735,12 +735,21 @@ Mocks.notes.public = async (post) => {
|
|||||||
const plaintext = posts.sanitizePlaintext(content);
|
const plaintext = posts.sanitizePlaintext(content);
|
||||||
const isArticle = post.pid === post.topic.mainPid && plaintext.length > 500;
|
const isArticle = post.pid === post.topic.mainPid && plaintext.length > 500;
|
||||||
|
|
||||||
const thumbs = await topics.thumbs.get(post.tid);
|
if (post.isMainPost) {
|
||||||
thumbs.forEach(({ name, path }) => {
|
const thumbs = await topics.thumbs.get(post.tid);
|
||||||
const mediaType = mime.getType(name);
|
thumbs.forEach(({ name, path }) => {
|
||||||
const url = `${nconf.get('url') + nconf.get('upload_url')}${path}`;
|
const mediaType = mime.getType(name);
|
||||||
attachment.push({ mediaType, url });
|
const url = `${nconf.get('url') + nconf.get('upload_url')}${path}`;
|
||||||
});
|
attachment.push({ mediaType, url });
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
const uploads = await posts.uploads.listWithSizes(post.pid);
|
||||||
|
uploads.forEach(({ name, width, height }) => {
|
||||||
|
const mediaType = mime.getType(name);
|
||||||
|
const url = `${nconf.get('url') + nconf.get('upload_url')}${name}`;
|
||||||
|
attachment.push({ mediaType, url, width, height });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Inspect post content for external imagery as well
|
// Inspect post content for external imagery as well
|
||||||
let match = posts.imgRegex.exec(post.content);
|
let match = posts.imgRegex.exec(post.content);
|
||||||
|
|||||||
Reference in New Issue
Block a user