Johann150
36a0e48e49
All checks were successful
ci/woodpecker/push/lint-client Pipeline was successful
ci/woodpecker/push/lint-foundkey-js Pipeline was successful
ci/woodpecker/push/lint-backend Pipeline was successful
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/test Pipeline was successful
There are still many places where import paths with `..` are used and maybe should use absolute paths also.
28 lines
759 B
TypeScript
28 lines
759 B
TypeScript
import { createDeleteAccountJob } from '@/queue/index.js';
|
|
import { CacheableRemoteUser } from '@/models/entities/user.js';
|
|
import { Users } from '@/models/index.js';
|
|
import { apLogger } from '@/remote/activitypub/logger.js';
|
|
|
|
const logger = apLogger;
|
|
|
|
export async function deleteActor(actor: CacheableRemoteUser, uri: string): Promise<string> {
|
|
logger.info(`Deleting the Actor: ${uri}`);
|
|
|
|
if (actor.uri !== uri) {
|
|
return `skip: delete actor ${actor.uri} !== ${uri}`;
|
|
}
|
|
|
|
const user = await Users.findOneByOrFail({ id: actor.id });
|
|
if (user.isDeleted) {
|
|
logger.info('skip: already deleted');
|
|
}
|
|
|
|
const job = await createDeleteAccountJob(actor);
|
|
|
|
await Users.update(actor.id, {
|
|
isDeleted: true,
|
|
});
|
|
|
|
return `ok: queued ${job.name} ${job.id}`;
|
|
}
|