mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
fix: simplify uid logic, explicitly mention all participants, even local users, #12834
This commit is contained in:
@@ -454,8 +454,6 @@ Mocks.notes.private = async ({ messageObj }) => {
|
|||||||
// todo: deleted messages
|
// todo: deleted messages
|
||||||
let uids = await messaging.getUidsInRoom(messageObj.roomId, 0, -1);
|
let uids = await messaging.getUidsInRoom(messageObj.roomId, 0, -1);
|
||||||
uids = uids.filter(uid => String(uid) !== String(messageObj.fromuid)); // no author
|
uids = uids.filter(uid => String(uid) !== String(messageObj.fromuid)); // no author
|
||||||
const remoteUids = uids.filter(uid => !utils.isNumber(uid)); // for mentions
|
|
||||||
uids = uids.map(uid => (utils.isNumber(uid) ? `${nconf.get('url')}/uid/${uid}` : uid));
|
|
||||||
const id = `${nconf.get('url')}/message/${messageObj.mid}`;
|
const id = `${nconf.get('url')}/message/${messageObj.mid}`;
|
||||||
const to = new Set(uids);
|
const to = new Set(uids);
|
||||||
const published = messageObj.timestampISO;
|
const published = messageObj.timestampISO;
|
||||||
@@ -470,12 +468,12 @@ Mocks.notes.private = async ({ messageObj }) => {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const mentions = await user.getUsersFields(remoteUids, ['uid', 'userslug']);
|
const mentions = await user.getUsersFields(uids, ['uid', 'userslug']);
|
||||||
const tag = [];
|
const tag = [];
|
||||||
tag.push(...mentions.map(({ uid, userslug }) => ({
|
tag.push(...mentions.map(({ uid, userslug }) => ({
|
||||||
type: 'Mention',
|
type: 'Mention',
|
||||||
href: uid,
|
href: utils.isNumber(uid) ? `${nconf.get('url')}/uid/${uid}` : uid,
|
||||||
name: userslug,
|
name: utils.isNumber(uid) ? `${userslug}@${nconf.get('url_parsed').hostname}` : userslug,
|
||||||
})));
|
})));
|
||||||
|
|
||||||
let inReplyTo;
|
let inReplyTo;
|
||||||
|
|||||||
Reference in New Issue
Block a user