diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-21 02:50:22 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-21 02:50:22 +0300 |
commit | 9dc93a4519d9d5d7be48ff274127136236a3adb3 (patch) | |
tree | 70467ae3692a0e35e5ea56bcb803eb512a10bedb /app/assets/javascripts/snippets | |
parent | 4b0f34b6d759d6299322b3a54453e930c6121ff0 (diff) |
Add latest changes from gitlab-org/gitlab@13-11-stable-eev13.11.0-rc43
Diffstat (limited to 'app/assets/javascripts/snippets')
4 files changed, 3 insertions, 57 deletions
diff --git a/app/assets/javascripts/snippets/components/edit.vue b/app/assets/javascripts/snippets/components/edit.vue index bee9d7b8c2a..c53d0575752 100644 --- a/app/assets/javascripts/snippets/components/edit.vue +++ b/app/assets/javascripts/snippets/components/edit.vue @@ -33,7 +33,6 @@ export default { SnippetBlobActionsEdit, TitleField, FormFooterActions, - CaptchaModal: () => import('~/captcha/captcha_modal.vue'), GlButton, GlLoadingIcon, }, @@ -68,10 +67,6 @@ export default { description: '', visibilityLevel: this.selectedLevel, }, - captchaResponse: '', - needsCaptchaResponse: false, - captchaSiteKey: '', - spamLogId: '', }; }, computed: { @@ -103,8 +98,6 @@ export default { description: this.snippet.description, visibilityLevel: this.snippet.visibilityLevel, blobActions: this.actions, - ...(this.spamLogId && { spamLogId: this.spamLogId }), - ...(this.captchaResponse && { captchaResponse: this.captchaResponse }), }; }, saveButtonLabel() { @@ -171,20 +164,14 @@ export default { }, handleFormSubmit() { this.isUpdating = true; + this.$apollo .mutate(this.newSnippet ? this.createMutation() : this.updateMutation()) .then(({ data }) => { const baseObj = this.newSnippet ? data?.createSnippet : data?.updateSnippet; - if (baseObj.needsCaptchaResponse) { - // If we need a captcha response, start process for receiving captcha response. - // We will resubmit after the response is obtained. - this.requestCaptchaResponse(baseObj.captchaSiteKey, baseObj.spamLogId); - return; - } - const errors = baseObj?.errors; - if (errors.length) { + if (errors?.length) { this.flashAPIFailure(errors[0]); } else { redirectTo(baseObj.snippet.webUrl); @@ -200,38 +187,6 @@ export default { updateActions(actions) { this.actions = actions; }, - /** - * Start process for getting captcha response from user - * - * @param captchaSiteKey Stored in data and used to display the captcha. - * @param spamLogId Stored in data and included when the form is re-submitted. - */ - requestCaptchaResponse(captchaSiteKey, spamLogId) { - this.captchaSiteKey = captchaSiteKey; - this.spamLogId = spamLogId; - this.needsCaptchaResponse = true; - }, - /** - * Handle the captcha response from the user - * - * @param captchaResponse The captchaResponse value emitted from the modal. - */ - receivedCaptchaResponse(captchaResponse) { - this.needsCaptchaResponse = false; - this.captchaResponse = captchaResponse; - - if (this.captchaResponse) { - // If the user solved the captcha, resubmit the form. - // NOTE: we do not need to clear out the captchaResponse and spamLogId - // data values after submit, because this component always does a full page reload. - // Otherwise, we would need to. - this.handleFormSubmit(); - } else { - // If the user didn't solve the captcha (e.g. they just closed the modal), - // finish the update and allow them to continue editing or manually resubmit the form. - this.isUpdating = false; - } - }, }, }; </script> @@ -249,11 +204,6 @@ export default { class="loading-animation prepend-top-20 gl-mb-6" /> <template v-else> - <captcha-modal - :captcha-site-key="captchaSiteKey" - :needs-captcha-response="needsCaptchaResponse" - @receivedCaptchaResponse="receivedCaptchaResponse" - /> <title-field id="snippet-title" v-model="snippet.title" diff --git a/app/assets/javascripts/snippets/components/embed_dropdown.vue b/app/assets/javascripts/snippets/components/embed_dropdown.vue index f6c9c569b5f..ad1b08a5a07 100644 --- a/app/assets/javascripts/snippets/components/embed_dropdown.vue +++ b/app/assets/javascripts/snippets/components/embed_dropdown.vue @@ -65,6 +65,7 @@ export default { <gl-button v-gl-tooltip.hover :title="$options.MSG_COPY" + :aria-label="$options.MSG_COPY" :data-clipboard-text="value" icon="copy-to-clipboard" data-qa-selector="copy_button" diff --git a/app/assets/javascripts/snippets/mutations/createSnippet.mutation.graphql b/app/assets/javascripts/snippets/mutations/createSnippet.mutation.graphql index 64d5d7c30fa..f688868d1b9 100644 --- a/app/assets/javascripts/snippets/mutations/createSnippet.mutation.graphql +++ b/app/assets/javascripts/snippets/mutations/createSnippet.mutation.graphql @@ -4,7 +4,5 @@ mutation CreateSnippet($input: CreateSnippetInput!) { snippet { webUrl } - needsCaptchaResponse - captchaSiteKey } } diff --git a/app/assets/javascripts/snippets/mutations/updateSnippet.mutation.graphql b/app/assets/javascripts/snippets/mutations/updateSnippet.mutation.graphql index 0a72f71b7c9..548725f7357 100644 --- a/app/assets/javascripts/snippets/mutations/updateSnippet.mutation.graphql +++ b/app/assets/javascripts/snippets/mutations/updateSnippet.mutation.graphql @@ -4,8 +4,5 @@ mutation UpdateSnippet($input: UpdateSnippetInput!) { snippet { webUrl } - needsCaptchaResponse - captchaSiteKey - spamLogId } } |