diff options
Diffstat (limited to 'app/assets/javascripts/snippets/components/edit.vue')
-rw-r--r-- | app/assets/javascripts/snippets/components/edit.vue | 54 |
1 files changed, 2 insertions, 52 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" |