diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-03-16 18:18:33 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-03-16 18:18:33 +0000 |
commit | f64a639bcfa1fc2bc89ca7db268f594306edfd7c (patch) | |
tree | a2c3c2ebcc3b45e596949db485d6ed18ffaacfa1 /app/assets/javascripts/issue_show/components/app.vue | |
parent | bfbc3e0d6583ea1a91f627528bedc3d65ba4b10f (diff) | |
download | gitlab-ce-f64a639bcfa1fc2bc89ca7db268f594306edfd7c.tar.gz |
Add latest changes from gitlab-org/gitlab@13-10-stable-eev13.10.0-rc40
Diffstat (limited to 'app/assets/javascripts/issue_show/components/app.vue')
-rw-r--r-- | app/assets/javascripts/issue_show/components/app.vue | 51 |
1 files changed, 22 insertions, 29 deletions
diff --git a/app/assets/javascripts/issue_show/components/app.vue b/app/assets/javascripts/issue_show/components/app.vue index e70c18040b3..9b978483cc6 100644 --- a/app/assets/javascripts/issue_show/components/app.vue +++ b/app/assets/javascripts/issue_show/components/app.vue @@ -5,7 +5,6 @@ import { deprecatedCreateFlash as createFlash } from '~/flash'; import Poll from '~/lib/utils/poll'; import { visitUrl } from '~/lib/utils/url_utility'; import { __, s__, sprintf } from '~/locale'; -import recaptchaModalImplementor from '~/vue_shared/mixins/recaptcha_modal_implementor'; import { IssuableStatus, IssuableStatusText, IssuableType } from '../constants'; import eventHub from '../event_hub'; import Service from '../services/index'; @@ -25,7 +24,6 @@ export default { formComponent, PinnedLinks, }, - mixins: [recaptchaModalImplementor], props: { endpoint: { required: true, @@ -250,6 +248,7 @@ export default { }, }, created() { + this.flashContainer = null; this.service = new Service(this.endpoint); this.poll = new Poll({ resource: this.service, @@ -289,7 +288,7 @@ export default { methods: { handleBeforeUnloadEvent(e) { const event = e; - if (this.showForm && this.issueChanged && !this.showRecaptcha) { + if (this.showForm && this.issueChanged) { event.returnValue = __('Are you sure you want to lose your issue information?'); } return undefined; @@ -307,7 +306,7 @@ export default { }); }, - updateAndShowForm(templates = []) { + updateAndShowForm(templates = {}) { if (!this.showForm) { this.showForm = true; this.store.setFormState({ @@ -347,10 +346,10 @@ export default { }, updateIssuable() { + this.clearFlash(); return this.service .updateIssuable(this.store.formState) .then((res) => res.data) - .then((data) => this.checkForSpam(data)) .then((data) => { if (!window.location.pathname.includes(data.web_url)) { visitUrl(data.web_url); @@ -361,28 +360,22 @@ export default { eventHub.$emit('close.form'); }) .catch((error = {}) => { - const { name, response = {} } = error; + const { message, response = {} } = error; - if (name === 'SpamError') { - this.openRecaptcha(); - } else { - let errMsg = this.defaultErrorMessage; + this.store.setFormState({ + updateLoading: false, + }); - if (response.data && response.data.errors) { - errMsg += `. ${response.data.errors.join(' ')}`; - } + let errMsg = this.defaultErrorMessage; - createFlash(errMsg); + if (response.data && response.data.errors) { + errMsg += `. ${response.data.errors.join(' ')}`; + } else if (message) { + errMsg += `. ${message}`; } - }); - }, - - closeRecaptchaModal() { - this.store.setFormState({ - updateLoading: false, - }); - this.closeRecaptcha(); + this.flashContainer = createFlash(errMsg); + }); }, deleteIssuable(payload) { @@ -409,6 +402,13 @@ export default { showStickyHeader() { this.isStickyHeaderShowing = true; }, + + clearFlash() { + if (this.flashContainer) { + this.flashContainer.style.display = 'none'; + this.flashContainer = null; + } + }, }, }; </script> @@ -430,13 +430,6 @@ export default { :enable-autocomplete="enableAutocomplete" :issuable-type="issuableType" /> - - <recaptcha-modal - v-show="showRecaptcha" - ref="recaptchaModal" - :html="recaptchaHTML" - @close="closeRecaptchaModal" - /> </div> <div v-else> <title-component |