mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-29 05:17:39 -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',
|
code: 'NOT_REMOTE',
|
||||||
id: '4362f8dc-731f-4ad8-a694-be2a88922a24',
|
id: '4362f8dc-731f-4ad8-a694-be2a88922a24',
|
||||||
},
|
},
|
||||||
|
adminForbidden: {
|
||||||
|
message: 'Adminds cant migrate.',
|
||||||
|
code: 'NOT_ADMIN_FORBIDDEN',
|
||||||
|
id: '4362e8dc-731f-4ad8-a694-be2a88922a24',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
|
@ -49,6 +54,7 @@ export const paramDef = {
|
||||||
// eslint-disable-next-line import/no-default-export
|
// eslint-disable-next-line import/no-default-export
|
||||||
export default define(meta, paramDef, async (ps, user) => {
|
export default define(meta, paramDef, async (ps, user) => {
|
||||||
if (!ps.moveToAccount) throw new ApiError(meta.errors.noSuchMoveTarget);
|
if (!ps.moveToAccount) throw new ApiError(meta.errors.noSuchMoveTarget);
|
||||||
|
if(user.isAdmin) throw new ApiError(meta.errors.adminForbidden);
|
||||||
|
|
||||||
let unfiltered: string = ps.moveToAccount;
|
let unfiltered: string = ps.moveToAccount;
|
||||||
|
|
||||||
|
|
|
@ -78,6 +78,12 @@ export const meta = {
|
||||||
code: 'YOU_HAVE_BEEN_BLOCKED',
|
code: 'YOU_HAVE_BEEN_BLOCKED',
|
||||||
id: 'b390d7e1-8a5e-46ed-b625-06271cafd3d3',
|
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;
|
} as const;
|
||||||
|
|
||||||
|
@ -163,6 +169,7 @@ export const paramDef = {
|
||||||
|
|
||||||
// eslint-disable-next-line import/no-default-export
|
// eslint-disable-next-line import/no-default-export
|
||||||
export default define(meta, paramDef, async (ps, user) => {
|
export default define(meta, paramDef, async (ps, user) => {
|
||||||
|
if(user.movedToUri) throw new ApiError(meta.errors.accountLocked);
|
||||||
let visibleUsers: User[] = [];
|
let visibleUsers: User[] = [];
|
||||||
if (ps.visibleUserIds) {
|
if (ps.visibleUserIds) {
|
||||||
visibleUsers = await Users.findBy({
|
visibleUsers = await Users.findBy({
|
||||||
|
|
Loading…
Reference in a new issue