mirror of
https://github.com/MisskeyIO/misskey
synced 2024-12-17 08:09:09 +09:00
125849673a
Co-authored-by: syuilo <syuilotan@yahoo.co.jp> Co-authored-by: Acid Chicken (硫酸鶏) <root@acid-chicken.com>
25 lines
610 B
TypeScript
25 lines
610 B
TypeScript
import User, { IUser } from '../../../models/user';
|
|
import FollowRequest from '../../../models/follow-request';
|
|
import accept from './accept';
|
|
|
|
/**
|
|
* 指定したユーザー宛てのフォローリクエストをすべて承認
|
|
* @param user ユーザー
|
|
*/
|
|
export default async function(user: IUser) {
|
|
const requests = await FollowRequest.find({
|
|
followeeId: user._id
|
|
});
|
|
|
|
for (const request of requests) {
|
|
const follower = await User.findOne({ _id: request.followerId });
|
|
accept(user, follower);
|
|
}
|
|
|
|
User.update({ _id: user._id }, {
|
|
$set: {
|
|
pendingReceivedFollowRequestsCount: 0
|
|
}
|
|
});
|
|
}
|