From 4955df3911146baf6f0ea8ba2a3b369932655057 Mon Sep 17 00:00:00 2001 From: syuilo Date: Mon, 7 May 2018 04:26:45 +0900 Subject: [PATCH] oops --- src/remote/resolve-user.ts | 5 +++++ src/services/note/create.ts | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/remote/resolve-user.ts b/src/remote/resolve-user.ts index 7acbf085a..c612a8c94 100644 --- a/src/remote/resolve-user.ts +++ b/src/remote/resolve-user.ts @@ -6,6 +6,11 @@ import { createPerson } from './activitypub/models/person'; export default async (username, _host, option?): Promise => { const usernameLower = username.toLowerCase(); + + if (_host == null) { + return await User.findOne({ usernameLower }); + } + const hostAscii = toASCII(_host).toLowerCase(); const host = toUnicode(hostAscii); diff --git a/src/services/note/create.ts b/src/services/note/create.ts index d68fead5c..634c2e263 100644 --- a/src/services/note/create.ts +++ b/src/services/note/create.ts @@ -30,7 +30,7 @@ class NotificationManager { private list: Array<{ user: ILocalUser['_id'], reason: Reason; - }>; + }> = []; constructor(user, note) { this.user = user; @@ -300,10 +300,10 @@ export default async (user: IUser, data: { }); // Append mentions data - if (mentions.length > 0) { + if (mentionedUsers.length > 0) { Note.update({ _id: note._id }, { $set: { - mentions + mentions: mentionedUsers.map(u => u._id) } }); }