From b9b944ba29a9fcc16f381218882b0b5d4295a63b Mon Sep 17 00:00:00 2001 From: Alys Date: Sun, 26 May 2019 07:52:10 +1000 Subject: [PATCH] replace similar messages about chat privileges removed with one generic one --- test/api/v3/integration/groups/POST-groups.test.js | 2 +- test/api/v3/integration/groups/POST-groups_invite.test.js | 8 ++++---- website/client/components/userMenu/inbox.vue | 2 +- website/common/locales/en/groups.json | 5 +---- website/server/controllers/api-v3/groups.js | 6 +++--- 5 files changed, 10 insertions(+), 13 deletions(-) diff --git a/test/api/v3/integration/groups/POST-groups.test.js b/test/api/v3/integration/groups/POST-groups.test.js index 9eeb6d0589..5fd322a564 100644 --- a/test/api/v3/integration/groups/POST-groups.test.js +++ b/test/api/v3/integration/groups/POST-groups.test.js @@ -149,7 +149,7 @@ describe('POST /group', () => { ).to.eventually.be.rejected.and.eql({ code: 401, error: 'NotAuthorized', - message: t('cannotCreatePublicGuildWhenMuted'), + message: t('chatPrivilegesRevoked'), }); }); }); diff --git a/test/api/v3/integration/groups/POST-groups_invite.test.js b/test/api/v3/integration/groups/POST-groups_invite.test.js index f5069b3875..2a648e2bb3 100644 --- a/test/api/v3/integration/groups/POST-groups_invite.test.js +++ b/test/api/v3/integration/groups/POST-groups_invite.test.js @@ -100,7 +100,7 @@ describe('Post /groups/:groupId/invite', () => { .to.eventually.be.rejected.and.eql({ code: 401, error: 'NotAuthorized', - message: t('cannotInviteWhenMuted'), + message: t('chatPrivilegesRevoked'), }); }); @@ -262,7 +262,7 @@ describe('Post /groups/:groupId/invite', () => { .to.eventually.be.rejected.and.eql({ code: 401, error: 'NotAuthorized', - message: t('cannotInviteWhenMuted'), + message: t('chatPrivilegesRevoked'), }); }); @@ -436,7 +436,7 @@ describe('Post /groups/:groupId/invite', () => { .to.eventually.be.rejected.and.eql({ code: 401, error: 'NotAuthorized', - message: t('cannotInviteWhenMuted'), + message: t('chatPrivilegesRevoked'), }); }); @@ -526,7 +526,7 @@ describe('Post /groups/:groupId/invite', () => { .to.eventually.be.rejected.and.eql({ code: 401, error: 'NotAuthorized', - message: t('cannotInviteWhenMuted'), + message: t('chatPrivilegesRevoked'), }); }); diff --git a/website/client/components/userMenu/inbox.vue b/website/client/components/userMenu/inbox.vue index ff36e3a325..ab2588b6c3 100644 --- a/website/client/components/userMenu/inbox.vue +++ b/website/client/components/userMenu/inbox.vue @@ -389,7 +389,7 @@ export default { if (this.user.flags.chatRevoked) { return { title: this.$t('PMPlaceholderTitleRevoked'), - description: this.$t('PMPlaceholderDescriptionRevoked'), + description: this.$t('chatPrivilegesRevoked'), }; } return { diff --git a/website/common/locales/en/groups.json b/website/common/locales/en/groups.json index ab127f9f33..cc06205b10 100644 --- a/website/common/locales/en/groups.json +++ b/website/common/locales/en/groups.json @@ -137,7 +137,6 @@ "PMPlaceholderTitle": "Nothing Here Yet", "PMPlaceholderDescription": "Select a conversation on the left", "PMPlaceholderTitleRevoked": "Your chat privileges have been revoked", - "PMPlaceholderDescriptionRevoked": "You are not able to send private messages because your chat privileges have been revoked. For details or to ask if your privileges can be returned, please email our Community Manager at admin@habitica.com or ask your parent or guardian to email them. Please include your @Username in the email. If a moderator has already told you that your chat ban is temporary, you do not need to send an email.", "PMReceive": "Receive Private Messages", "PMEnabledOptPopoverText": "Private Messages are enabled. Users can contact you via your profile.", "PMDisabledOptPopoverText": "Private Messages are disabled. Enable this option to allow users to contact you via your profile.", @@ -266,9 +265,7 @@ "userRequestsApproval": "<%= userName %> requests approval", "userCountRequestsApproval": "<%= userCount %> members request approval", "youAreRequestingApproval": "You are requesting approval", - "chatPrivilegesRevoked": "You cannot do that because your chat privileges have been removed. For details or to ask if your privileges can be returned, please email our Community Manager at admin@habitica.com or ask your parent or guardian to email them. Please include your @Username in the email. If a moderator has already told you that your chat ban is temporary, you do not need to send an email.", - "cannotCreatePublicGuildWhenMuted": "You cannot create a public guild because your chat privileges have been revoked. For details or to ask if your privileges can be returned, please email our Community Manager at admin@habitica.com or ask your parent or guardian to email them. Please include your @Username in the email. If a moderator has already told you that your chat ban is temporary, you do not need to send an email.", - "cannotInviteWhenMuted": "You cannot invite anyone to a guild or party because your chat privileges have been revoked. For details or to ask if your privileges can be returned, please email our Community Manager at admin@habitica.com or ask your parent or guardian to email them. Please include your @Username in the email. If a moderator has already told you that your chat ban is temporary, you do not need to send an email.", + "chatPrivilegesRevoked": "You cannot do this because your chat privileges have been removed. For details or to ask if your privileges can be returned, please email our Community Manager at admin@habitica.com or ask your parent or guardian to email them. Please include your @Username in the email. If a moderator has already told you that your chat ban is temporary, you do not need to send an email.", "newChatMessagePlainNotification": "New message in <%= groupName %> by <%= authorName %>. Click here to open the chat page!", "newChatMessageTitle": "New message in <%= groupName %>", "exportInbox": "Export Messages", diff --git a/website/server/controllers/api-v3/groups.js b/website/server/controllers/api-v3/groups.js index eed4aff4cb..991f30982f 100644 --- a/website/server/controllers/api-v3/groups.js +++ b/website/server/controllers/api-v3/groups.js @@ -82,7 +82,7 @@ let api = {}; * @apiError (401) {NotAuthorized} messageInsufficientGems User does not have enough gems (4) * @apiError (401) {NotAuthorized} partyMustbePrivate Party must have privacy set to private * @apiError (401) {NotAuthorized} messageGroupAlreadyInParty - * @apiError (401) {NotAuthorized} cannotCreatePublicGuildWhenMuted You cannot create a public guild because your chat privileges have been revoked. + * @apiError (401) {NotAuthorized} chatPrivilegesRevoked You cannot do this because your chat privileges have been removed... * * @apiSuccess (201) {Object} data The created group (See /website/server/models/group.js) * @@ -117,7 +117,7 @@ api.createGroup = { group.leader = user._id; if (group.type === 'guild') { - if (group.privacy === 'public' && user.flags.chatRevoked) throw new NotAuthorized(res.t('cannotCreatePublicGuildWhenMuted')); + if (group.privacy === 'public' && user.flags.chatRevoked) throw new NotAuthorized(res.t('chatPrivilegesRevoked')); if (user.balance < 1) throw new NotAuthorized(res.t('messageInsufficientGems')); group.balance = 1; @@ -1011,7 +1011,7 @@ api.inviteToGroup = { async handler (req, res) { const user = res.locals.user; - if (user.flags.chatRevoked) throw new NotAuthorized(res.t('cannotInviteWhenMuted')); + if (user.flags.chatRevoked) throw new NotAuthorized(res.t('chatPrivilegesRevoked')); req.checkParams('groupId', apiError('groupIdRequired')).notEmpty();