1
0
mirror of https://github.com/hotomoe/hotomoe synced 2024-11-29 07:18:13 +09:00

リストをインポートしたときにプロキシアカウントがフォローするように修正

This commit is contained in:
syuilo 2019-03-11 19:51:58 +09:00
parent c3d34bda37
commit 496f42805d
No known key found for this signature in database
GPG Key ID: BDC4C49D06AB9D69

View File

@ -6,7 +6,7 @@ import * as mongo from 'mongodb';
import * as request from 'request'; import * as request from 'request';
import { queueLogger } from '../../logger'; import { queueLogger } from '../../logger';
import User from '../../../models/user'; import User, { isRemoteUser, fetchProxyAccount } from '../../../models/user';
import config from '../../../config'; import config from '../../../config';
import UserList from '../../../models/user-list'; import UserList from '../../../models/user-list';
import DriveFile from '../../../models/drive-file'; import DriveFile from '../../../models/drive-file';
@ -14,6 +14,9 @@ import chalk from 'chalk';
import { getOriginalUrl } from '../../../misc/get-drive-file-url'; import { getOriginalUrl } from '../../../misc/get-drive-file-url';
import parseAcct from '../../../misc/acct/parse'; import parseAcct from '../../../misc/acct/parse';
import resolveUser from '../../../remote/resolve-user'; 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'); const logger = queueLogger.createSubLogger('import-user-lists');
@ -132,6 +135,13 @@ export async function importUserLists(job: Bull.Job, done: any): Promise<void> {
userIds: target._id userIds: target._id
} }
}); });
// このインスタンス内にこのリモートユーザーをフォローしているユーザーがいなくても投稿を受け取るためにダミーのユーザーがフォローしたということにする
if (isRemoteUser(target)) {
const proxy = await fetchProxyAccount();
const content = renderActivity(renderFollow(proxy, user));
deliver(proxy, content, target.inbox);
}
} }
logger.succ('Imported'); logger.succ('Imported');