mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-25 19:37:34 -07:00
Add admin and account locked error.
This commit is contained in:
parent
6e283ef5e6
commit
3abebba245
2 changed files with 13 additions and 0 deletions
|
@ -35,6 +35,11 @@ export const meta = {
|
|||
code: 'NOT_REMOTE',
|
||||
id: '4362f8dc-731f-4ad8-a694-be2a88922a24',
|
||||
},
|
||||
adminForbidden: {
|
||||
message: 'Adminds cant migrate.',
|
||||
code: 'NOT_ADMIN_FORBIDDEN',
|
||||
id: '4362e8dc-731f-4ad8-a694-be2a88922a24',
|
||||
},
|
||||
},
|
||||
} as const;
|
||||
|
||||
|
@ -49,6 +54,7 @@ export const paramDef = {
|
|||
// eslint-disable-next-line import/no-default-export
|
||||
export default define(meta, paramDef, async (ps, user) => {
|
||||
if (!ps.moveToAccount) throw new ApiError(meta.errors.noSuchMoveTarget);
|
||||
if(user.isAdmin) throw new ApiError(meta.errors.adminForbidden);
|
||||
|
||||
let unfiltered: string = ps.moveToAccount;
|
||||
|
||||
|
|
|
@ -78,6 +78,12 @@ export const meta = {
|
|||
code: 'YOU_HAVE_BEEN_BLOCKED',
|
||||
id: 'b390d7e1-8a5e-46ed-b625-06271cafd3d3',
|
||||
},
|
||||
|
||||
accountLocked: {
|
||||
message: 'You migrated. Your account is now locked.',
|
||||
code: 'ACCOUNT_LOCKED',
|
||||
id: 'd390d7e1-8a5e-46ed-b625-06271cafd3d3',
|
||||
},
|
||||
},
|
||||
} as const;
|
||||
|
||||
|
@ -163,6 +169,7 @@ export const paramDef = {
|
|||
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default define(meta, paramDef, async (ps, user) => {
|
||||
if(user.movedToUri) throw new ApiError(meta.errors.accountLocked);
|
||||
let visibleUsers: User[] = [];
|
||||
if (ps.visibleUserIds) {
|
||||
visibleUsers = await Users.findBy({
|
||||
|
|
Loading…
Reference in a new issue