diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-10-20 11:43:02 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-10-20 11:43:02 +0300 |
commit | d9ab72d6080f594d0b3cae15f14b3ef2c6c638cb (patch) | |
tree | 2341ef426af70ad1e289c38036737e04b0aa5007 /app/assets/javascripts/invite_members | |
parent | d6e514dd13db8947884cd58fe2a9c2a063400a9b (diff) |
Add latest changes from gitlab-org/gitlab@14-4-stable-eev14.4.0-rc42
Diffstat (limited to 'app/assets/javascripts/invite_members')
-rw-r--r-- | app/assets/javascripts/invite_members/components/invite_members_modal.vue | 13 | ||||
-rw-r--r-- | app/assets/javascripts/invite_members/utils/response_message_parser.js | 5 |
2 files changed, 13 insertions, 5 deletions
diff --git a/app/assets/javascripts/invite_members/components/invite_members_modal.vue b/app/assets/javascripts/invite_members/components/invite_members_modal.vue index ab42e8cdfeb..cd0b413265b 100644 --- a/app/assets/javascripts/invite_members/components/invite_members_modal.vue +++ b/app/assets/javascripts/invite_members/components/invite_members_modal.vue @@ -11,9 +11,10 @@ import { GlFormInput, GlFormCheckboxGroup, } from '@gitlab/ui'; -import { partition, isString } from 'lodash'; +import { partition, isString, unescape } from 'lodash'; import Api from '~/api'; import ExperimentTracking from '~/experimentation/experiment_tracking'; +import { sanitize } from '~/lib/dompurify'; import { BV_SHOW_MODAL } from '~/lib/utils/constants'; import { s__, sprintf } from '~/locale'; import { @@ -293,7 +294,7 @@ export default { }; }, conditionallyShowToastSuccess(response) { - const message = responseMessageFromSuccess(response); + const message = this.unescapeMsg(responseMessageFromSuccess(response)); if (message === '') { this.showToastMessageSuccess(); @@ -309,13 +310,17 @@ export default { this.closeModal(); }, showInvalidFeedbackMessage(response) { + const message = this.unescapeMsg(responseMessageFromError(response)); + this.isLoading = false; - this.invalidFeedbackMessage = - responseMessageFromError(response) || this.$options.labels.invalidFeedbackMessageDefault; + this.invalidFeedbackMessage = message || this.$options.labels.invalidFeedbackMessageDefault; }, handleMembersTokenSelectClear() { this.invalidFeedbackMessage = ''; }, + unescapeMsg(message) { + return unescape(sanitize(message, { ALLOWED_TAGS: [] })); + }, }, labels: { members: { diff --git a/app/assets/javascripts/invite_members/utils/response_message_parser.js b/app/assets/javascripts/invite_members/utils/response_message_parser.js index b7bc9ea5652..52ec3be3205 100644 --- a/app/assets/javascripts/invite_members/utils/response_message_parser.js +++ b/app/assets/javascripts/invite_members/utils/response_message_parser.js @@ -18,7 +18,10 @@ function responseMessageStringForMultiple(message) { return message.includes(':'); } function responseMessageStringFirstPart(message) { - return message.split(' and ')[0]; + const firstPart = message.split(':')[1]; + const firstMsg = firstPart.split(/ and [\w-]*$/)[0].trim(); + + return firstMsg; } export function responseMessageFromError(response) { |