This commit is contained in:
parent
1625fdc2f4
commit
32da569ef6
|
@ -40,6 +40,12 @@ export type Source = {
|
||||||
site_key: string;
|
site_key: string;
|
||||||
secret_key: string;
|
secret_key: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ゴーストアカウントのID
|
||||||
|
*/
|
||||||
|
ghost?: string;
|
||||||
|
|
||||||
accesslog?: string;
|
accesslog?: string;
|
||||||
twitter?: {
|
twitter?: {
|
||||||
consumer_key: string;
|
consumer_key: string;
|
||||||
|
|
|
@ -458,3 +458,7 @@ function img(url) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
export function getGhost(): Promise<ILocalUser> {
|
||||||
|
return User.findOne({ _id: new mongo.ObjectId(config.ghost) });
|
||||||
|
}
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
import $ from 'cafy'; import ID from '../../../../../cafy-id';
|
import $ from 'cafy'; import ID from '../../../../../cafy-id';
|
||||||
import UserList from '../../../../../models/user-list';
|
import UserList from '../../../../../models/user-list';
|
||||||
import User, { pack as packUser } from '../../../../../models/user';
|
import User, { pack as packUser, isRemoteUser, getGhost } from '../../../../../models/user';
|
||||||
import { publishUserListStream } from '../../../../../publishers/stream';
|
import { publishUserListStream } from '../../../../../publishers/stream';
|
||||||
|
import ap from '../../../../../remote/activitypub/renderer';
|
||||||
|
import renderFollow from '../../../../../remote/activitypub/renderer/follow';
|
||||||
|
import { deliver } from '../../../../../queue';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a user to a user list
|
* Add a user to a user list
|
||||||
|
@ -48,4 +51,11 @@ module.exports = async (params, me) => new Promise(async (res, rej) => {
|
||||||
res();
|
res();
|
||||||
|
|
||||||
publishUserListStream(userList._id, 'userAdded', await packUser(user));
|
publishUserListStream(userList._id, 'userAdded', await packUser(user));
|
||||||
|
|
||||||
|
// このインスタンス内にこのリモートユーザーをフォローしているユーザーがいなくても投稿を受け取るためにダミーのユーザーがフォローしたということにする
|
||||||
|
if (isRemoteUser(user)) {
|
||||||
|
const ghost = await getGhost();
|
||||||
|
const content = ap(renderFollow(ghost, user));
|
||||||
|
deliver(ghost, content, user.inbox);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue