server: use named export for acceptFollowRequest

This commit is contained in:
Norm 2022-12-22 16:41:06 -05:00
parent e2ef800708
commit b11e4053db
Signed by untrusted user: norm
GPG key ID: 7123E30E441E80DE
4 changed files with 12 additions and 7 deletions

View file

@ -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';
};

View file

@ -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';

View file

@ -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);
}
}

View file

@ -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,