mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-05-07 11:17:29 +02:00
feat: federate tags out on new post (if new topic)
This commit is contained in:
@@ -210,6 +210,7 @@ Mocks.note = async (post) => {
|
|||||||
|
|
||||||
let inReplyTo = null;
|
let inReplyTo = null;
|
||||||
let name = null;
|
let name = null;
|
||||||
|
let tag = null;
|
||||||
if (post.toPid) { // direct reply
|
if (post.toPid) { // direct reply
|
||||||
inReplyTo = utils.isNumber(post.toPid) ? `${nconf.get('url')}/post/${post.toPid}` : post.toPid;
|
inReplyTo = utils.isNumber(post.toPid) ? `${nconf.get('url')}/post/${post.toPid}` : post.toPid;
|
||||||
const parentId = await posts.getPostField(post.toPid, 'uid');
|
const parentId = await posts.getPostField(post.toPid, 'uid');
|
||||||
@@ -219,6 +220,11 @@ Mocks.note = async (post) => {
|
|||||||
to.unshift(utils.isNumber(post.topic.uid) ? `${nconf.get('url')}/uid/${post.topic.uid}` : post.topic.uid);
|
to.unshift(utils.isNumber(post.topic.uid) ? `${nconf.get('url')}/uid/${post.topic.uid}` : post.topic.uid);
|
||||||
} else { // new topic
|
} else { // new topic
|
||||||
name = await topics.getTitleByPid(post.pid);
|
name = await topics.getTitleByPid(post.pid);
|
||||||
|
tag = post.topic.tags.map(tag => ({
|
||||||
|
type: 'Hashtag',
|
||||||
|
href: `${nconf.get('url')}/tags/${tag.valueEncoded}`,
|
||||||
|
name: `#${tag.value}`,
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
const object = {
|
const object = {
|
||||||
@@ -240,6 +246,7 @@ Mocks.note = async (post) => {
|
|||||||
content: raw,
|
content: raw,
|
||||||
mediaType: 'text/markdown',
|
mediaType: 'text/markdown',
|
||||||
},
|
},
|
||||||
|
tag,
|
||||||
// replies: {} todo...
|
// replies: {} todo...
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user