server: use named export for acceptFollowRequest
This commit is contained in:
parent
e2ef800708
commit
b11e4053db
4 changed files with 12 additions and 7 deletions
|
@ -1,5 +1,5 @@
|
|||
import { CacheableRemoteUser } from '@/models/entities/user.js';
|
||||
import accept from '@/services/following/requests/accept.js';
|
||||
import { acceptFollowRequest } from '@/services/following/requests/accept.js';
|
||||
import { relayAccepted } from '@/services/relay.js';
|
||||
import { IFollow } from '@/remote/activitypub/type.js';
|
||||
import { DbResolver } from '@/remote/activitypub/db-resolver.js';
|
||||
|
@ -24,6 +24,6 @@ export default async (actor: CacheableRemoteUser, activity: IFollow): Promise<st
|
|||
return await relayAccepted(match[1]);
|
||||
}
|
||||
|
||||
await accept(actor, follower);
|
||||
await acceptFollowRequest(actor, follower);
|
||||
return 'ok';
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import acceptFollowRequest from '@/services/following/requests/accept.js';
|
||||
import { acceptFollowRequest } from '@/services/following/requests/accept.js';
|
||||
import define from '../../../define.js';
|
||||
import { ApiError } from '../../../error.js';
|
||||
import { getUser } from '../../../common/getters.js';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { User } from '@/models/entities/user.js';
|
||||
import { FollowRequests, Users } from '@/models/index.js';
|
||||
import accept from './accept.js';
|
||||
import { acceptFollowRequest } from './accept.js';
|
||||
|
||||
/**
|
||||
* 指定したユーザー宛てのフォローリクエストをすべて承認
|
||||
|
@ -13,6 +13,6 @@ export default async function(user: { id: User['id']; host: User['host']; uri: U
|
|||
|
||||
for (const request of requests) {
|
||||
const follower = await Users.findOneByOrFail({ id: request.followerId });
|
||||
accept(user, follower);
|
||||
acceptFollowRequest(user, follower);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,12 +3,17 @@ import renderFollow from '@/remote/activitypub/renderer/follow.js';
|
|||
import renderAccept from '@/remote/activitypub/renderer/accept.js';
|
||||
import { deliver } from '@/queue/index.js';
|
||||
import { publishMainStream } from '@/services/stream.js';
|
||||
import { User, CacheableUser } from '@/models/entities/user.js';
|
||||
import { User } from '@/models/entities/user.js';
|
||||
import { FollowRequests, Users } from '@/models/index.js';
|
||||
import { IdentifiableError } from '@/misc/identifiable-error.js';
|
||||
import { insertFollowingDoc } from '../create.js';
|
||||
|
||||
export default async function(followee: { id: User['id']; host: User['host']; uri: User['host']; inbox: User['inbox']; sharedInbox: User['sharedInbox']; }, follower: CacheableUser) {
|
||||
/**
|
||||
* Accept a follow request from user `followee` to follow `follower`.
|
||||
* @param followee User who is being followed
|
||||
* @param follower User making the follow request
|
||||
*/
|
||||
export async function acceptFollowRequest(followee: User, follower: User): Promise<void> {
|
||||
const request = await FollowRequests.findOneBy({
|
||||
followeeId: followee.id,
|
||||
followerId: follower.id,
|
||||
|
|
Loading…
Reference in a new issue