Only starts autosave if user is logged in

This commit is contained in:
Filipa Lacerda 2017-08-13 17:18:45 +01:00
parent fdfab012f0
commit 240d262db3
2 changed files with 7 additions and 2 deletions

View file

@ -35,7 +35,10 @@ window.Autosave = (function() {
// v-model does not update with jQuery trigger
// https://github.com/vuejs/vue/issues/2804#issuecomment-216968137
const event = new Event('change', { bubbles: true, cancelable: false });
this.field.get(0).dispatchEvent(event);
const field = this.field.get(0);
if (field) {
field.dispatchEvent(event);
}
}
};

View file

@ -184,7 +184,9 @@
}
},
initAutoSave() {
this.autosave = new Autosave($(this.$refs.textarea), ['Note', 'Issue', this.getIssueData.id], 'issue');
if (this.isLoggedIn) {
this.autosave = new Autosave($(this.$refs.textarea), ['Note', 'Issue', this.getIssueData.id], 'issue');
}
},
initTaskList() {
return new TaskList({