});
},
- updateAfterAction (fetch) {
+ updateAfterAction (response) {
if (this.popup) {
this.popup.destroy();
}
- if (fetch) {
- this.resetIssue();
+ if (response) {
+ this.model.set(this.model.parse(response));
}
},
$.ajax({
type: 'POST',
url: window.baseUrl + '/api/issues/delete_comment?key=' + commentKey
- }).done(() => this.updateAfterAction(true));
+ }).done(r => this.updateAfterAction(r));
}
});
this.popup.render();
},
action (action) {
- const that = this;
this.disableControls();
return this.model.customAction(action)
- .done(() => {
- that.updateAfterAction(true);
- })
- .fail(() => {
- that.enableControls();
- });
+ .done(r => this.updateAfterAction(r))
+ .fail(() => this.enableControls());
},
editTags (e) {
_injectCommentsRelational (issue, users) {
if (issue.comments) {
- const that = this;
const newComments = issue.comments.map(comment => {
let newComment = { ...comment, author: comment.login };
delete newComment.login;
- newComment = that._injectRelational(newComment, users, 'author', 'login');
+ newComment = this._injectRelational(newComment, users, 'author', 'login');
return newComment;
});
- issue = { ...issue, comments: newComments };
+ return { ...issue, comments: newComments };
}
return issue;
},
},
cancel () {
- this.options.detailView.updateAfterAction(false);
+ this.options.detailView.updateAfterAction();
},
disableForm () {
},
submit () {
- const that = this;
const text = this.ui.textarea.val();
if (!text.length) {
this.disableForm();
this.options.detailView.disableControls();
return $.post(url, data)
- .done(() => {
- that.options.detailView.updateAfterAction(true);
- }).fail(() => {
- that.enableForm();
- that.options.detailView.enableControls();
+ .done(r => this.options.detailView.updateAfterAction(r))
+ .fail(() => {
+ this.enableForm();
+ this.options.detailView.enableControls();
});
},