mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-15 21:10:22 +01:00
feat: native image appending for remote private notes
This commit is contained in:
@@ -411,7 +411,10 @@ Mocks.message = async (object) => {
|
||||
mid: object.id,
|
||||
uid: object.attributedTo,
|
||||
content: object.sourceContent || object.content,
|
||||
// ip: caller.ip,
|
||||
|
||||
_activitypub: {
|
||||
attachment: object.attachment,
|
||||
},
|
||||
};
|
||||
|
||||
return message;
|
||||
|
||||
@@ -339,6 +339,16 @@ Notes.assertPrivate = async (object) => {
|
||||
|
||||
const payload = await activitypub.mocks.message(object);
|
||||
|
||||
// Naive image appending (using src/posts/attachments.js is likely better, but not worth the effort)
|
||||
if (payload._activitypub.hasOwnProperty('attachment')) {
|
||||
const images = payload._activitypub.attachment.filter((attachment) => {
|
||||
return attachment.mediaType.startsWith('image/');
|
||||
}).map(({ url, href }) => url || href);
|
||||
images.forEach((url) => {
|
||||
payload.content += `<p><img class="img-fluid img-thumbnail" src="${url}" /></p>`;
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
await messaging.checkContent(payload.content, false);
|
||||
} catch (e) {
|
||||
|
||||
Reference in New Issue
Block a user