mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-02 12:05:57 +01:00
feat: mentions support
This commit is contained in:
@@ -235,9 +235,17 @@ Mocks.note = async (post) => {
|
||||
|
||||
if (matches.size) {
|
||||
tag = tag || [];
|
||||
Array.from(matches).map(match => ({
|
||||
type: 'Mention',
|
||||
name: match,
|
||||
tag.push(...Array.from(matches).map(({ id: href, slug: name }) => {
|
||||
if (utils.isNumber(href)) { // local ref
|
||||
href = `${nconf.get('url')}/user/${name.slice(1)}`;
|
||||
name = `${name}@${nconf.get('url_parsed').hostname}`;
|
||||
}
|
||||
|
||||
return {
|
||||
type: 'Mention',
|
||||
href,
|
||||
name,
|
||||
};
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user