mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-02 12:05:57 +01:00
fix: persist sourceContent into post hash when ingesting remote posts, update markdown so that field is parsed instead of ignoring content
This commit is contained in:
@@ -103,7 +103,7 @@
|
||||
"nodebb-plugin-dbsearch": "6.2.5",
|
||||
"nodebb-plugin-emoji": "6.0.1",
|
||||
"nodebb-plugin-emoji-android": "4.1.1",
|
||||
"nodebb-plugin-markdown": "13.0.0-pre.9",
|
||||
"nodebb-plugin-markdown": "13.0.0-pre.10",
|
||||
"nodebb-plugin-mentions": "4.6.10",
|
||||
"nodebb-plugin-spam-be-gone": "2.2.2",
|
||||
"nodebb-plugin-web-push": "0.7.0",
|
||||
|
||||
@@ -177,7 +177,10 @@ Mocks.post = async (objects) => {
|
||||
let edited = new Date(updated);
|
||||
edited = Number.isNaN(edited.valueOf()) ? undefined : edited;
|
||||
|
||||
if (content && content.length) {
|
||||
const sourceContent = source && source.mediaType === 'text/markdown' ? source.content : undefined;
|
||||
if (sourceContent) {
|
||||
content = null;
|
||||
} else if (content && content.length) {
|
||||
content = sanitize(content, sanitizeConfig);
|
||||
content = await activitypub.helpers.remoteAnchorToLocalProfile(content);
|
||||
} else {
|
||||
@@ -190,7 +193,7 @@ Mocks.post = async (objects) => {
|
||||
// tid, --> purposely omitted
|
||||
name,
|
||||
content,
|
||||
sourceContent: source && source.mediaType === 'text/markdown' ? source.content : undefined,
|
||||
sourceContent,
|
||||
timestamp,
|
||||
toPid,
|
||||
|
||||
|
||||
@@ -179,6 +179,7 @@ Notes.assert = async (uid, input, options = { skipChecks: false }) => {
|
||||
timestamp,
|
||||
tags,
|
||||
content: mainPost.content,
|
||||
sourceContent: mainPost.sourceContent,
|
||||
_activitypub: mainPost._activitypub,
|
||||
}),
|
||||
Notes.updateLocalRecipients(mainPid, { to, cc }),
|
||||
|
||||
@@ -16,7 +16,7 @@ const isEmojiShortcode = /^:[\w]+:$/;
|
||||
module.exports = function (Posts) {
|
||||
Posts.create = async function (data) {
|
||||
// This is an internal method, consider using Topics.reply instead
|
||||
const { uid, tid, _activitypub } = data;
|
||||
const { uid, tid, _activitypub, sourceContent } = data;
|
||||
const content = data.content.toString();
|
||||
const timestamp = data.timestamp || Date.now();
|
||||
const isMain = data.isMain || false;
|
||||
@@ -30,7 +30,7 @@ module.exports = function (Posts) {
|
||||
}
|
||||
|
||||
const pid = data.pid || await db.incrObjectField('global', 'nextPid');
|
||||
let postData = { pid, uid, tid, content, timestamp };
|
||||
let postData = { pid, uid, tid, content, sourceContent, timestamp };
|
||||
|
||||
if (data.toPid) {
|
||||
postData.toPid = data.toPid;
|
||||
|
||||
@@ -100,7 +100,7 @@ module.exports = function (Topics) {
|
||||
await Topics.validateTags(data.tags, data.cid, uid);
|
||||
data.tags = await Topics.filterTags(data.tags, data.cid);
|
||||
if (!data.fromQueue && !isAdmin) {
|
||||
Topics.checkContent(data.content);
|
||||
Topics.checkContent(data.sourceContent || data.content);
|
||||
if (!await posts.canUserPostContentWithLinks(uid, data.content)) {
|
||||
throw new Error(`[[error:not-enough-reputation-to-post-links, ${meta.config['min:rep:post-links']}]]`);
|
||||
}
|
||||
@@ -186,7 +186,7 @@ module.exports = function (Topics) {
|
||||
|
||||
if (!data.fromQueue && !isAdmin) {
|
||||
await user.isReadyToPost(uid, data.cid);
|
||||
Topics.checkContent(data.content);
|
||||
Topics.checkContent(data.sourceContent || data.content);
|
||||
if (!await posts.canUserPostContentWithLinks(uid, data.content)) {
|
||||
throw new Error(`[[error:not-enough-reputation-to-post-links, ${meta.config['min:rep:post-links']}]]`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user