Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/issue_show/components/app.vue')
-rw-r--r--app/assets/javascripts/issue_show/components/app.vue51
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