refactor(backend): use insert instead of save
This commit is contained in:
@ -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)) {
|
||||
|
@ -16,12 +16,12 @@ export async function registerOrFetchInstanceDoc(host: string): Promise<Instance
|
||||
const index = await Instances.findOne({ host });
|
||||
|
||||
if (index == null) {
|
||||
const i = await Instances.save({
|
||||
const i = await Instances.insert({
|
||||
id: genId(),
|
||||
host,
|
||||
caughtAt: new Date(),
|
||||
lastCommunicatedAt: new Date(),
|
||||
});
|
||||
}).then(x => Instances.findOneOrFail(x.identifiers[0]));
|
||||
|
||||
federationChart.update(true);
|
||||
|
||||
|
Reference in New Issue
Block a user