Hook that allows custom logic before saving the composer

This commit is contained in:
Robin Ward 2019-10-11 14:41:05 -04:00
parent 4d67f2a8ed
commit ee4369f972
1 changed files with 15 additions and 8 deletions

View File

@ -744,15 +744,22 @@ const Composer = RestModel.extend({
return false; return false;
}, },
save(opts) { // Overwrite to implement custom logic
if (!this.cantSubmitPost) { beforeSave() {
// change category may result in some effect for topic featured link return Ember.RSVP.Promise.resolve();
if (!this.canEditTopicFeaturedLink) { },
this.set("featuredLink", null);
}
return this.editingPost ? this.editPost(opts) : this.createPost(opts); save(opts) {
} return this.beforeSave().then(() => {
if (!this.cantSubmitPost) {
// change category may result in some effect for topic featured link
if (!this.canEditTopicFeaturedLink) {
this.set("featuredLink", null);
}
return this.editingPost ? this.editPost(opts) : this.createPost(opts);
}
});
}, },
clearState() { clearState() {