mirror of
https://github.com/discourse/discourse.git
synced 2025-01-18 17:12:45 +08:00
FIX: with featured links enabled and uncategorized topic not allowed, allow featued links behaviour before choosing a category
This commit is contained in:
parent
0d826ea933
commit
783490f763
|
@ -143,7 +143,8 @@ const Composer = RestModel.extend({
|
|||
if (!this.siteSettings.topic_featured_link_enabled || !canEditTitle || creatingPrivateMessage) { return false; }
|
||||
|
||||
const categoryIds = this.site.get('topic_featured_link_allowed_category_ids');
|
||||
if (!categoryId && categoryIds && categoryIds.indexOf(this.site.get('uncategorized_category_id')) !== -1) { return true; }
|
||||
if (!categoryId && categoryIds &&
|
||||
(categoryIds.indexOf(this.site.get('uncategorized_category_id')) !== -1 || !this.siteSettings.allow_uncategorized_topics)) { return true; }
|
||||
return categoryIds === undefined || !categoryIds.length || categoryIds.indexOf(categoryId) !== -1;
|
||||
},
|
||||
|
||||
|
|
|
@ -248,3 +248,11 @@ test("title placeholder depends on what you're doing", function() {
|
|||
composer = createComposer({action: Composer.PRIVATE_MESSAGE});
|
||||
equal(composer.get('titlePlaceholder'), 'composer.title_placeholder', "placeholder for private message with topic links enabled");
|
||||
});
|
||||
|
||||
test("allows featured link before choosing a category", function() {
|
||||
Discourse.SiteSettings.topic_featured_link_enabled = true;
|
||||
Discourse.SiteSettings.allow_uncategorized_topics = false;
|
||||
let composer = createComposer({action: Composer.CREATE_TOPIC});
|
||||
equal(composer.get('titlePlaceholder'), 'composer.title_or_link_placeholder', "placeholder invites you to paste a link");
|
||||
ok(composer.get('canEditTopicFeaturedLink'), "can paste link");
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue
Block a user