summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Schatz <jschatz@gitlab.com>2018-01-18 12:20:59 -0500
committerJacob Schatz <jschatz@gitlab.com>2018-01-18 12:20:59 -0500
commit77fe779fa9548bb65f97554bd964ee5a80a68513 (patch)
tree8da260b34a6a008afd0b63e51f41c4985c11cce3
parent89c3c88e6d681d3c9297f5ed506a8075a272610d (diff)
downloadgitlab-ce-77fe779fa9548bb65f97554bd964ee5a80a68513.tar.gz
Remove Event listener and make code more readable.
-rw-r--r--app/assets/javascripts/issue_show/components/app.vue12
1 files changed, 8 insertions, 4 deletions
diff --git a/app/assets/javascripts/issue_show/components/app.vue b/app/assets/javascripts/issue_show/components/app.vue
index f622a364592..9fbbca79752 100644
--- a/app/assets/javascripts/issue_show/components/app.vue
+++ b/app/assets/javascripts/issue_show/components/app.vue
@@ -153,10 +153,13 @@
return !!this.state.updatedAt;
},
issueChanged() {
- return this.initialDescriptionText
- !== this.store.formState.description
- || this.initialTitleText
- !== this.store.formState.title;
+ let descriptionChanged =
+ this.initialDescriptionText !== this.store.formState.description;
+
+ let titleChanged =
+ this.initialTitleText !== this.store.formState.title;
+
+ return descriptionChanged || titleChanged;
},
},
created() {
@@ -194,6 +197,7 @@
eventHub.$off('update.issuable', this.updateIssuable);
eventHub.$off('close.form', this.closeForm);
eventHub.$off('open.form', this.openForm);
+ window.removeEventListener('beforeunload', this.handleBeforeUnloadEvent);
},
methods: {
handleBeforeUnloadEvent(e) {