On remote notes, not use content for detecting mentions (#3170)

* On remote note, detect mentioned users from to/cc

* fix
This commit is contained in:
MeiMei 2018-11-09 08:44:19 +09:00 committed by syuilo
parent 5ef8a8b5f0
commit 5b684c6deb
2 changed files with 23 additions and 1 deletions

View file

@ -98,6 +98,7 @@ type Option = {
cw?: string;
visibility?: string;
visibleUsers?: IUser[];
apMentions?: IUser[];
uri?: string;
app?: IApp;
};
@ -149,7 +150,7 @@ export default async (user: IUser, data: Option, silent = false) => new Promise<
const emojis = extractEmojis(tokens);
const mentionedUsers = await extractMentionedUsers(tokens);
const mentionedUsers = data.apMentions || await extractMentionedUsers(tokens);
if (data.reply && !user._id.equals(data.reply.userId) && !mentionedUsers.some(u => u._id.equals(data.reply.userId))) {
mentionedUsers.push(await User.findOne({ _id: data.reply.userId }));