mirror of
https://github.com/wassname/talk.git
synced 2026-07-02 17:58:09 +08:00
662f5ce314
* Throw error if user tries to ignore a staff member Throws a UserCannotBeIgnoredError if a user tries to ignore a user who is a staff member. A staff member in this case is considered anyone who has a role of staff, moderator, or admin. CORL-409 * Prevent users from ignoring staff in the user info popover Creates the staff roles in a constant next to the user model. Uses this to add a computed property to the user resolver. CORL-409 * Remove unnecessary async declaration from userIsStaff helper function CORL-409 * Specify ignoreable on users in client test fixtures Allows the tests to pass for the required computed property of ignoreable that is computed by whether a user is a staff member or not. CORL-409 * Update more fixtures with ignoreable property on mocked users/commenters CORL-409 * Consolidate ignore-able calculation into re-usable helper methods Re-use the logic for whether a role is a staff member to clearly define when a user is ignore-able or not across the business logic. CORL-409 * Set the ignoreable optimisticResponse on comment mutations We have set the ignoreable value in the graphQL schema, so now the optimisticResponses are looking for a default value to use until the data result arrives. Put to false since the ignoreable value is set on our author, we likely don't want to ignore ourselves. CORL-409
49 lines
2.2 KiB
TypeScript
49 lines
2.2 KiB
TypeScript
import { ERROR_CODES } from "coral-common/errors";
|
|
|
|
export const ERROR_TRANSLATIONS: Record<ERROR_CODES, string> = {
|
|
COMMENT_BODY_EXCEEDS_MAX_LENGTH: "error-commentBodyExceedsMaxLength",
|
|
COMMENT_BODY_TOO_SHORT: "error-commentBodyTooShort",
|
|
COMMENT_NOT_FOUND: "error-commentNotFound",
|
|
COMMENTING_DISABLED: "error-commentingDisabled",
|
|
DUPLICATE_EMAIL: "error-duplicateEmail",
|
|
DUPLICATE_STORY_URL: "error-duplicateStoryURL",
|
|
DUPLICATE_USER: "error-duplicateUser",
|
|
EMAIL_ALREADY_SET: "error-emailAlreadySet",
|
|
EMAIL_EXCEEDS_MAX_LENGTH: "error-emailExceedsMaxLength",
|
|
EMAIL_INVALID_FORMAT: "error-emailInvalidFormat",
|
|
EMAIL_NOT_SET: "error-emailNotSet",
|
|
INTERNAL_ERROR: "error-internalError",
|
|
LOCAL_PROFILE_ALREADY_SET: "error-localProfileAlreadySet",
|
|
LOCAL_PROFILE_NOT_SET: "error-localProfileNotSet",
|
|
NOT_FOUND: "error-notFound",
|
|
PASSWORD_TOO_SHORT: "error-passwordTooShort",
|
|
STORY_CLOSED: "error-storyClosed",
|
|
STORY_NOT_FOUND: "error-storyNotFound",
|
|
STORY_URL_NOT_PERMITTED: "error-storyURLNotPermitted",
|
|
URL_NOT_PERMITTED: "error-urlNotPermitted",
|
|
TENANT_INSTALLED_ALREADY: "error-tenantInstalledAlready",
|
|
TENANT_NOT_FOUND: "error-tenantNotFound",
|
|
TOKEN_INVALID: "error-tokenInvalid",
|
|
TOKEN_NOT_FOUND: "error-tokenNotFound",
|
|
USER_NOT_ENTITLED: "error-userNotEntitled",
|
|
USER_NOT_FOUND: "error-userNotFound",
|
|
USER_CANNOT_BE_IGNORED: "error-userCannotBeIgnored",
|
|
USERNAME_ALREADY_SET: "error-usernameAlreadySet",
|
|
USERNAME_CONTAINS_INVALID_CHARACTERS:
|
|
"error-usernameContainsInvalidCharacters",
|
|
USERNAME_EXCEEDS_MAX_LENGTH: "error-usernameExceedsMaxLength",
|
|
USERNAME_TOO_SHORT: "error-usernameTooShort",
|
|
AUTHENTICATION_ERROR: "error-authenticationError",
|
|
INVALID_CREDENTIALS: "error-invalidCredentials",
|
|
TOXIC_COMMENT: "error-toxicComment",
|
|
SPAM_COMMENT: "error-spamComment",
|
|
USER_ALREADY_SUSPENDED: "error-userAlreadySuspended",
|
|
USER_ALREADY_BANNED: "error-userAlreadyBanned",
|
|
USER_BANNED: "error-userBanned",
|
|
USER_SUSPENDED: "error-userSuspended",
|
|
INTEGRATION_DISABLED: "error-integrationDisabled",
|
|
PASSWORD_RESET_TOKEN_EXPIRED: "error-passwordResetTokenExpired",
|
|
EMAIL_CONFIRM_TOKEN_EXPIRED: "error-emailConfirmTokenExpired",
|
|
RATE_LIMIT_EXCEEDED: "error-rateLimitExceeded",
|
|
};
|