FIX: When appending tags to restricted category posts, we need to pass the category id, or it won't work. (#9020)

This commit is contained in:
Roman Rizzi 2020-02-27 14:10:14 -03:00 committed by GitHub
parent c9b53d5647
commit 87f15f9ed6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 4 deletions

View File

@ -219,6 +219,11 @@ export default Component.extend({
}
},
setCategory(category) {
this.set("searchedTerms.category", category);
this.set("category", category);
},
setSearchedTermValueForCategory() {
const match = this.filterBlocks(REGEXP_CATEGORY_PREFIX);
if (match.length !== 0) {
@ -235,21 +240,21 @@ export default Component.extend({
(!existingInput && userInput) ||
(existingInput && userInput && existingInput.id !== userInput.id)
)
this.set("searchedTerms.category", userInput);
this.setCategory(userInput);
} else if (isNaN(subcategories)) {
const userInput = Category.findSingleBySlug(subcategories[0]);
if (
(!existingInput && userInput) ||
(existingInput && userInput && existingInput.id !== userInput.id)
)
this.set("searchedTerms.category", userInput);
this.setCategory(userInput);
} else {
const userInput = Category.findById(subcategories[0]);
if (
(!existingInput && userInput) ||
(existingInput && userInput && existingInput.id !== userInput.id)
)
this.set("searchedTerms.category", userInput);
this.setCategory(userInput);
}
} else this.set("searchedTerms.category", "");
},

View File

@ -17,6 +17,7 @@ export default DiscourseRoute.extend({
context: {},
skip_context: {}
},
category: null,
titleToken() {
return I18n.t("search.results_page", {

View File

@ -36,7 +36,7 @@
{{#if canBulkSelect}}
{{d-button icon="list" class="btn-default bulk-select" title="topics.bulk.toggle" action=(action "toggleBulkSelect")}}
{{bulk-select-button selected=selected action=(action "search")}}
{{bulk-select-button selected=selected category=category action=(action "search")}}
{{/if}}
{{#if bulkSelectEnabled}}
@ -211,6 +211,7 @@
{{search-advanced-options
searchTerm=searchTerm
isExpanded=true
category=category
}}
{{d-button