feat: auto note removal

This commit is contained in:
아르페 2024-02-16 08:21:04 +09:00 committed by 무라쿠모
parent ee6d918d99
commit 82a7cdb204
No known key found for this signature in database
GPG key ID: 139D6573F92DA9F7
10 changed files with 166 additions and 14 deletions

View file

@ -13,6 +13,7 @@ import { DI } from '@/di-symbols.js';
import type Logger from '@/logger.js';
import generateUserToken from '@/misc/generate-native-user-token.js';
import type { UsedUsernamesRepository, UsersRepository } from '@/models/_.js';
import { MiAutoRemovalCondition } from '@/models/AutoRemovalCondition.js';
import { MiUser } from '@/models/User.js';
import { MiUserProfile } from '@/models/UserProfile.js';
import { MiUserKeypair } from '@/models/UserKeypair.js';
@ -137,12 +138,20 @@ export class SignupService {
if (exist) throw new Error(' the username is already used');
const condition = await transactionalEntityManager.save(new MiAutoRemovalCondition({
id: this.idService.gen(),
deleteAfter: 7,
noPiningNotes: false,
noSpecifiedNotes: false,
}));
account = await transactionalEntityManager.save(new MiUser({
id: this.idService.gen(),
username: username,
usernameLower: username.toLowerCase(),
host: this.utilityService.toPunyNullable(host),
token: secret,
autoRemovalConditionId: condition.id,
isRoot: isTheFirstUser,
}));