From 4473a8fd0a2e14f9bc30e30a1bdfdbdc632680ad Mon Sep 17 00:00:00 2001 From: syuilo Date: Mon, 11 Mar 2019 19:51:58 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=AA=E3=82=B9=E3=83=88=E3=82=92=E3=82=A4?= =?UTF-8?q?=E3=83=B3=E3=83=9D=E3=83=BC=E3=83=88=E3=81=97=E3=81=9F=E3=81=A8?= =?UTF-8?q?=E3=81=8D=E3=81=AB=E3=83=97=E3=83=AD=E3=82=AD=E3=82=B7=E3=82=A2?= =?UTF-8?q?=E3=82=AB=E3=82=A6=E3=83=B3=E3=83=88=E3=81=8C=E3=83=95=E3=82=A9?= =?UTF-8?q?=E3=83=AD=E3=83=BC=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/queue/processors/db/import-user-lists.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/queue/processors/db/import-user-lists.ts b/src/queue/processors/db/import-user-lists.ts index ee1468d5a..aad11df7f 100644 --- a/src/queue/processors/db/import-user-lists.ts +++ b/src/queue/processors/db/import-user-lists.ts @@ -6,7 +6,7 @@ import * as mongo from 'mongodb'; import * as request from 'request'; import { queueLogger } from '../../logger'; -import User from '../../../models/user'; +import User, { isRemoteUser, fetchProxyAccount } from '../../../models/user'; import config from '../../../config'; import UserList from '../../../models/user-list'; import DriveFile from '../../../models/drive-file'; @@ -14,6 +14,9 @@ import chalk from 'chalk'; import { getOriginalUrl } from '../../../misc/get-drive-file-url'; import parseAcct from '../../../misc/acct/parse'; import resolveUser from '../../../remote/resolve-user'; +import { renderActivity } from '../../../remote/activitypub/renderer'; +import renderFollow from '../../../remote/activitypub/renderer/follow'; +import { deliver } from '../..'; const logger = queueLogger.createSubLogger('import-user-lists'); @@ -132,6 +135,13 @@ export async function importUserLists(job: Bull.Job, done: any): Promise { userIds: target._id } }); + + // このインスタンス内にこのリモートユーザーをフォローしているユーザーがいなくても投稿を受け取るためにダミーのユーザーがフォローしたということにする + if (isRemoteUser(target)) { + const proxy = await fetchProxyAccount(); + const content = renderActivity(renderFollow(proxy, user)); + deliver(proxy, content, target.inbox); + } } logger.succ('Imported');