Skip to content

Commit 447db0a

Browse files
sofyenneJihed525
authored andcommitted
fix: disable the text search when filtering by drafts - MEED-10296 - Meeds-io/meeds#3917 (#692)
Prior to this change, when searching for news using a text query and selecting the drafts filter, the results returned were posted articles. This issue occurs because only news articles are indexed, making text search for drafts not possible. This change will disable text search when the drafts filter is selected.
1 parent 25e7449 commit 447db0a

File tree

1 file changed

+6
-3
lines changed
  • content-webapp/src/main/webapp/vue-app/news/components

1 file changed

+6
-3
lines changed

content-webapp/src/main/webapp/vue-app/news/components/NewsApp.vue

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,14 @@
2929
<v-spacer />
3030
<div
3131
class="d-flex flex-row justify-end my-auto flex-nowrap">
32-
<div :class="searchInputDisplayed ? '' : 'newsAppHideSearchInput'">
32+
<div>
3333
<div class="inputNewsSearchWrapper">
3434
<v-scale-transition>
3535
<v-text-field
3636
v-model="searchText"
3737
:placeholder="$t('news.app.searchPlaceholder')"
3838
prepend-inner-icon="fa-filter"
39+
:disabled="disableSearchText"
3940
class="pa-0 my-auto" />
4041
</v-scale-transition>
4142
</div>
@@ -139,7 +140,6 @@ export default {
139140
searchText: '',
140141
searchNews: '',
141142
searchDelay: 300,
142-
searchInputDisplayed: false,
143143
newsFilter: '',
144144
spacesFilter: [],
145145
newsStatusLabel: this.$t('news.app.filter.all'),
@@ -185,6 +185,9 @@ export default {
185185
confirmDeleteNewsDialogTitle() {
186186
return this.isDraftsFilter ? this.$t('news.title.confirmDeleteDraftNews') : this.$t('news.title.confirmDeleteNews');
187187
},
188+
disableSearchText() {
189+
return this.isDraftsFilter;
190+
}
188191
},
189192
watch: {
190193
searchText() {
@@ -372,7 +375,7 @@ export default {
372375
},
373376
fetchNews(append = true) {
374377
this.loadingNews = true;
375-
const searchTerm = this.searchText.trim().toLowerCase();
378+
const searchTerm = !this.isDraftsFilter && this.searchText.trim().toLowerCase() || '';
376379
const offset = append ? this.newsList.length : 0;
377380
return this.$newsServices.getNews(this.newsFilter, this.spacesFilter, searchTerm, offset, this.newsPerPage + 1, false).then(data => {
378381
if (data.news && data.news.length) {

0 commit comments

Comments
 (0)