mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 19:37:55 +08:00
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'),
|
||||
|
||||
// Whether to disable the post button
|
||||
// whether to disable the post button
|
||||
cantSubmitPost: function() {
|
||||
|
||||
// Can't submit while loading
|
||||
// can't submit while loading
|
||||
if (this.get('loading')) return true;
|
||||
|
||||
// Title is required when:
|
||||
// - creating a new topic
|
||||
// - editing the 1st post
|
||||
// - creating a private message
|
||||
|
||||
// title is required when
|
||||
// - creating a new topic/private message
|
||||
// - editing the 1st post
|
||||
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
|
||||
if (this.get('missingReplyCharacters') > 0) return true;
|
||||
|
||||
return this.get('canCategorize') &&
|
||||
!Discourse.SiteSettings.allow_uncategorized_topics &&
|
||||
!this.get('categoryId') &&
|
||||
!Discourse.User.currentProp('staff');
|
||||
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') &&
|
||||
!Discourse.SiteSettings.allow_uncategorized_topics &&
|
||||
!this.get('categoryId') &&
|
||||
!Discourse.User.currentProp('staff');
|
||||
}
|
||||
}.property('loading', 'canEditTitle', 'titleLength', 'targetUsernames', 'replyLength', 'categoryId', 'missingReplyCharacters'),
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue
Block a user