Skip to content

A platform for community discussion. Free, open, simple.

FIX: save draft when either title or reply is present (#11243)

Arpit Jalan0853208d6709
diff --git a/app/assets/javascripts/discourse/app/models/composer.js b/app/assets/javascripts/discourse/app/models/composer.js
index 0d6c4367d86..bf594f253ca 100644
--- a/app/assets/javascripts/discourse/app/models/composer.js
+++ b/app/assets/javascripts/discourse/app/models/composer.js
@@ -1127,26 +1127,22 @@ const Composer = RestModel.extend({
if (this.canEditTitle) {
// Save title and/or post body
- if (!this.title && !this.reply) {
+ if (isEmpty(this.title) && isEmpty(this.reply)) {
return Promise.resolve();
}
- if (
- this.title &&
- this.titleLengthValid &&
- this.reply &&
- this.replyLength < this.siteSettings.min_post_length
- ) {
+ // Do not save when both title and reply's length are too small
+ if (!this.titleLengthValid && this.replyLength < this.minimumPostLength) {
return Promise.resolve();
}
} else {
// Do not save when there is no reply
- if (!this.reply) {
+ if (isEmpty(this.reply)) {
return Promise.resolve();
}
// Do not save when the reply's length is too small
- if (this.replyLength < this.siteSettings.min_post_length) {
+ if (this.replyLength < this.minimumPostLength) {
return Promise.resolve();
}
}