refactor(backend): use insert instead of save

This commit is contained in:
syuilo 2022-01-26 00:51:26 +09:00
parent 91c56ceb6e
commit 37a4e5f4fc
6 changed files with 10 additions and 10 deletions

View file

@ -25,7 +25,7 @@ export default async function(follower: { id: User['id']; host: User['host']; ur
if (blocking != null) throw new Error('blocking');
if (blocked != null) throw new Error('blocked');
const followRequest = await FollowRequests.save({
const followRequest = await FollowRequests.insert({
id: genId(),
createdAt: new Date(),
followerId: follower.id,
@ -39,7 +39,7 @@ export default async function(follower: { id: User['id']; host: User['host']; ur
followeeHost: followee.host,
followeeInbox: Users.isRemoteUser(followee) ? followee.inbox : undefined,
followeeSharedInbox: Users.isRemoteUser(followee) ? followee.sharedInbox : undefined,
});
}).then(x => FollowRequests.findOneOrFail(x.identifiers[0]));
// Publish receiveRequest event
if (Users.isLocalUser(followee)) {