From 11c30eccb339ea4c29eacb3178a62744e7184519 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 12 Apr 2019 00:42:39 +0900 Subject: [PATCH] =?UTF-8?q?=E9=9D=9E=E6=AD=A3=E8=A6=8F=E5=8C=96=E3=82=AB?= =?UTF-8?q?=E3=83=A9=E3=83=A0=E3=82=92=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 非正規化するほどの情報じゃない --- src/models/entities/note.ts | 6 ------ src/services/note/create.ts | 9 ++++++--- src/services/note/reaction/create.ts | 4 +++- src/services/note/reaction/delete.ts | 4 +++- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/models/entities/note.ts b/src/models/entities/note.ts index 5e8397819..253d157b8 100644 --- a/src/models/entities/note.ts +++ b/src/models/entities/note.ts @@ -195,12 +195,6 @@ export class Note { }) public userHost: string | null; - @Column('varchar', { - length: 128, nullable: true, - comment: '[Denormalized]' - }) - public userInbox: string | null; - @Column({ ...id(), nullable: true, diff --git a/src/services/note/create.ts b/src/services/note/create.ts index bc1225cd4..9f79bf7a6 100644 --- a/src/services/note/create.ts +++ b/src/services/note/create.ts @@ -329,12 +329,16 @@ async function publish(user: User, note: Note, reply: Note, renote: Note, noteAc if (Users.isLocalUser(user)) { // 投稿がリプライかつ投稿者がローカルユーザーかつリプライ先の投稿の投稿者がリモートユーザーなら配送 if (reply && reply.userHost !== null) { - deliver(user, noteActivity, reply.userInbox); + Users.findOne(reply.userId).then(u => { + deliver(user, noteActivity, u.inbox); + }); } // 投稿がRenoteかつ投稿者がローカルユーザーかつRenote元の投稿の投稿者がリモートユーザーなら配送 if (renote && renote.userHost !== null) { - deliver(user, noteActivity, renote.userInbox); + Users.findOne(renote.userId).then(u => { + deliver(user, noteActivity, u.inbox); + }); } } @@ -377,7 +381,6 @@ async function insertNote(user: User, data: Option, tags: string[], emojis: stri renoteUserId: data.renote ? data.renote.userId : null, renoteUserHost: data.renote ? data.renote.userHost : null, userHost: user.host, - userInbox: user.inbox, }; if (data.uri != null) insert.uri = data.uri; diff --git a/src/services/note/reaction/create.ts b/src/services/note/reaction/create.ts index 1b026cc9c..55f9bcd08 100644 --- a/src/services/note/reaction/create.ts +++ b/src/services/note/reaction/create.ts @@ -90,7 +90,9 @@ export default async (user: User, note: Note, reaction: string) => { // リアクターがローカルユーザーかつリアクション対象がリモートユーザーの投稿なら配送 if (Users.isLocalUser(user) && note.userHost !== null) { const content = renderActivity(renderLike(user, note, reaction)); - deliver(user, content, note.userInbox); + Users.findOne(note.userId).then(u => { + deliver(user, content, u.inbox); + }); } //#endregion }; diff --git a/src/services/note/reaction/delete.ts b/src/services/note/reaction/delete.ts index ce180aaec..76f5ed631 100644 --- a/src/services/note/reaction/delete.ts +++ b/src/services/note/reaction/delete.ts @@ -41,7 +41,9 @@ export default async (user: User, note: Note) => { // リアクターがローカルユーザーかつリアクション対象がリモートユーザーの投稿なら配送 if (Users.isLocalUser(user) && (note.userHost !== null)) { const content = renderActivity(renderUndo(renderLike(user, note, exist.reaction), user)); - deliver(user, content, note.userInbox); + Users.findOne(note.userId).then(u => { + deliver(user, content, u.inbox); + }); } //#endregion };