diff --git a/app/assets/javascripts/discourse/components/search-advanced-options.js.es6 b/app/assets/javascripts/discourse/components/search-advanced-options.js.es6 index 0bc886a8178..07e0097b7c2 100644 --- a/app/assets/javascripts/discourse/components/search-advanced-options.js.es6 +++ b/app/assets/javascripts/discourse/components/search-advanced-options.js.es6 @@ -77,7 +77,8 @@ export default Em.Component.extend({ likes: false, private: false, seen: false - } + }, + all_tags: false }, status: '', min_post_count: '', @@ -230,13 +231,15 @@ export default Em.Component.extend({ const match = this.filterBlocks(REGEXP_TAGS_PREFIX); const tags = this.get('searchedTerms.tags'); + const contain_all_tags = this.get('searchedTerms.special.all_tags'); if (match.length !== 0) { - const existingInput = _.isArray(tags) ? tags.join(',') : tags; + const join_char = contain_all_tags ? ',' : '|'; + const existingInput = _.isArray(tags) ? tags.join(join_char) : tags; const userInput = match[0].replace(REGEXP_TAGS_REPLACE, ''); if (existingInput !== userInput) { - this.set('searchedTerms.tags', (userInput.length !== 0) ? userInput.split(',') : []); + this.set('searchedTerms.tags', (userInput.length !== 0) ? userInput.split(join_char) : []); } } else if (tags.length !== 0) { this.set('searchedTerms.tags', []); @@ -365,14 +368,16 @@ export default Em.Component.extend({ } }, - @observes('searchedTerms.tags') + @observes('searchedTerms.tags', 'searchedTerms.special.all_tags') updateSearchTermForTags() { const match = this.filterBlocks(REGEXP_TAGS_PREFIX); const tagFilter = this.get('searchedTerms.tags'); let searchTerm = this.get('searchTerm') || ''; + const contain_all_tags = this.get('searchedTerms.special.all_tags'); if (tagFilter && tagFilter.length !== 0) { - const tags = tagFilter.join(','); + const join_char = contain_all_tags ? ',' : '|'; + const tags = tagFilter.join(join_char); if (match.length !== 0) { searchTerm = searchTerm.replace(match[0], `tags:${tags}`); diff --git a/app/assets/javascripts/discourse/templates/components/search-advanced-options.hbs b/app/assets/javascripts/discourse/templates/components/search-advanced-options.hbs index 71a9c1b6198..b83baf1cc4c 100644 --- a/app/assets/javascripts/discourse/templates/components/search-advanced-options.hbs +++ b/app/assets/javascripts/discourse/templates/components/search-advanced-options.hbs @@ -41,12 +41,15 @@
{{tag-chooser tags=searchedTerms.tags blacklist=searchedTerms.tags allowCreate=false placeholder="" everyTag="true" unlimitedTagCount="true" width="70%"}} +
+ +
{{/if}} -
+
contain_all_tags
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 0ab3ececb79..e9528e7eace 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -1340,6 +1340,7 @@ en: seen: I've read unseen: I've not read wiki: are wiki + all_tags: Contains all tags statuses: label: Where topics open: are open