FIX: editing the 1st post of a private message wasn't working
This commit is contained in:
parent
45820e9c4c
commit
1210486623
|
@ -100,33 +100,29 @@ Discourse.Composer = Discourse.Model.extend({
|
||||||
|
|
||||||
hidePreview: Em.computed.not('showPreview'),
|
hidePreview: Em.computed.not('showPreview'),
|
||||||
|
|
||||||
// Whether to disable the post button
|
// whether to disable the post button
|
||||||
cantSubmitPost: function() {
|
cantSubmitPost: function() {
|
||||||
|
// can't submit while loading
|
||||||
// Can't submit while loading
|
|
||||||
if (this.get('loading')) return true;
|
if (this.get('loading')) return true;
|
||||||
|
|
||||||
// Title is required when:
|
// title is required when
|
||||||
// - creating a new topic
|
// - creating a new topic/private message
|
||||||
// - editing the 1st post
|
// - editing the 1st post
|
||||||
// - creating a private message
|
|
||||||
|
|
||||||
if (this.get('canEditTitle') && !this.get('titleLengthValid')) return true;
|
if (this.get('canEditTitle') && !this.get('titleLengthValid')) return true;
|
||||||
|
|
||||||
// Need at least one user when sending a private message
|
|
||||||
if ( this.get('creatingPrivateMessage') &&
|
|
||||||
this.get('targetUsernames') &&
|
|
||||||
(this.get('targetUsernames').trim() + ',').indexOf(',') === 0) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// reply is always required
|
// reply is always required
|
||||||
if (this.get('missingReplyCharacters') > 0) return true;
|
if (this.get('missingReplyCharacters') > 0) return true;
|
||||||
|
|
||||||
|
if (this.get("privateMessage")) {
|
||||||
|
// need at least one user when sending a PM
|
||||||
|
return this.get('targetUsernames') && (this.get('targetUsernames').trim() + ',').indexOf(',') === 0;
|
||||||
|
} else {
|
||||||
|
// has a category? (when needed)
|
||||||
return this.get('canCategorize') &&
|
return this.get('canCategorize') &&
|
||||||
!Discourse.SiteSettings.allow_uncategorized_topics &&
|
!Discourse.SiteSettings.allow_uncategorized_topics &&
|
||||||
!this.get('categoryId') &&
|
!this.get('categoryId') &&
|
||||||
!Discourse.User.currentProp('staff');
|
!Discourse.User.currentProp('staff');
|
||||||
|
}
|
||||||
}.property('loading', 'canEditTitle', 'titleLength', 'targetUsernames', 'replyLength', 'categoryId', 'missingReplyCharacters'),
|
}.property('loading', 'canEditTitle', 'titleLength', 'targetUsernames', 'replyLength', 'categoryId', 'missingReplyCharacters'),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue