Update user friendly errors for translations (#15000)
Force msg typing instead of string for user friendly errors
This commit is contained in:
@@ -8,6 +8,8 @@ import {
|
||||
Resolver,
|
||||
} from '@nestjs/graphql';
|
||||
|
||||
import { msg } from '@lingui/core/macro';
|
||||
|
||||
import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
|
||||
import { ApiKeyRoleService } from 'src/engine/core-modules/api-key/api-key-role.service';
|
||||
import { FeatureFlagKey } from 'src/engine/core-modules/feature-flag/enums/feature-flag-key.enum';
|
||||
@@ -92,8 +94,7 @@ export class RoleResolver {
|
||||
PermissionsExceptionMessage.CANNOT_UPDATE_SELF_ROLE,
|
||||
PermissionsExceptionCode.CANNOT_UPDATE_SELF_ROLE,
|
||||
{
|
||||
userFriendlyMessage:
|
||||
'You cannot change your own role. Please ask another administrator to update your role.',
|
||||
userFriendlyMessage: msg`You cannot change your own role. Please ask another administrator to update your role.`,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { InjectRepository } from '@nestjs/typeorm';
|
||||
|
||||
import { t } from '@lingui/core/macro';
|
||||
import { msg } from '@lingui/core/macro';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
import { Repository } from 'typeorm';
|
||||
|
||||
@@ -122,8 +122,7 @@ export class RoleService {
|
||||
PermissionsExceptionMessage.ROLE_NOT_FOUND,
|
||||
PermissionsExceptionCode.ROLE_NOT_FOUND,
|
||||
{
|
||||
userFriendlyMessage:
|
||||
'The role you are looking for could not be found. It may have been deleted or you may not have access to it.',
|
||||
userFriendlyMessage: msg`The role you are looking for could not be found. It may have been deleted or you may not have access to it.`,
|
||||
},
|
||||
);
|
||||
}
|
||||
@@ -169,8 +168,7 @@ export class RoleService {
|
||||
PermissionsExceptionMessage.DEFAULT_ROLE_NOT_FOUND,
|
||||
PermissionsExceptionCode.DEFAULT_ROLE_NOT_FOUND,
|
||||
{
|
||||
userFriendlyMessage:
|
||||
'The default role for this workspace could not be found. Please contact support for assistance.',
|
||||
userFriendlyMessage: msg`The default role for this workspace could not be found. Please contact support for assistance.`,
|
||||
},
|
||||
);
|
||||
}
|
||||
@@ -277,8 +275,7 @@ export class RoleService {
|
||||
error.message,
|
||||
PermissionsExceptionCode.INVALID_ARG,
|
||||
{
|
||||
userFriendlyMessage:
|
||||
'Some of the information provided is invalid. Please check your input and try again.',
|
||||
userFriendlyMessage: msg`Some of the information provided is invalid. Please check your input and try again.`,
|
||||
},
|
||||
);
|
||||
}
|
||||
@@ -299,7 +296,7 @@ export class RoleService {
|
||||
throw new PermissionsException(
|
||||
PermissionsExceptionMessage.ROLE_LABEL_ALREADY_EXISTS,
|
||||
PermissionsExceptionCode.ROLE_LABEL_ALREADY_EXISTS,
|
||||
{ userFriendlyMessage: t`A role with this label already exists.` },
|
||||
{ userFriendlyMessage: msg`A role with this label already exists.` },
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -344,8 +341,7 @@ export class RoleService {
|
||||
PermissionsExceptionMessage.CANNOT_GIVE_WRITING_PERMISSION_WITHOUT_READING_PERMISSION,
|
||||
PermissionsExceptionCode.CANNOT_GIVE_WRITING_PERMISSION_WITHOUT_READING_PERMISSION,
|
||||
{
|
||||
userFriendlyMessage:
|
||||
'You cannot grant edit permissions without also granting read permissions. Please enable read access first.',
|
||||
userFriendlyMessage: msg`You cannot grant edit permissions without also granting read permissions. Please enable read access first.`,
|
||||
},
|
||||
);
|
||||
}
|
||||
@@ -403,8 +399,7 @@ export class RoleService {
|
||||
PermissionsExceptionMessage.ROLE_NOT_EDITABLE,
|
||||
PermissionsExceptionCode.ROLE_NOT_EDITABLE,
|
||||
{
|
||||
userFriendlyMessage:
|
||||
'This role cannot be modified because it is a system role. Only custom roles can be edited.',
|
||||
userFriendlyMessage: msg`This role cannot be modified because it is a system role. Only custom roles can be edited.`,
|
||||
},
|
||||
);
|
||||
}
|
||||
@@ -422,8 +417,7 @@ export class RoleService {
|
||||
PermissionsExceptionMessage.DEFAULT_ROLE_CANNOT_BE_DELETED,
|
||||
PermissionsExceptionCode.DEFAULT_ROLE_CANNOT_BE_DELETED,
|
||||
{
|
||||
userFriendlyMessage:
|
||||
'The default role cannot be deleted as it is required for the workspace to function properly.',
|
||||
userFriendlyMessage: msg`The default role cannot be deleted as it is required for the workspace to function properly.`,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user