From a56d47c768063b156d719b86bad4b275a7d8c986 Mon Sep 17 00:00:00 2001 From: "John R. Supplee" Date: Fri, 15 Jan 2021 00:33:24 +0200 Subject: [PATCH] Global search fixes * use @ and # as the abbrevs for the user and list operators * comment out debug code * Modify display of card result counts * Fix bug with publication not returning current user document --- client/components/main/globalSearch.jade | 8 ++--- client/components/main/globalSearch.js | 39 +++++++++--------------- i18n/en.i18n.json | 11 ++++--- models/cards.js | 6 ++++ server/publications/cards.js | 6 ++-- 5 files changed, 34 insertions(+), 36 deletions(-) diff --git a/client/components/main/globalSearch.jade b/client/components/main/globalSearch.jade index e666482cf..f2d2a2c7c 100644 --- a/client/components/main/globalSearch.jade +++ b/client/components/main/globalSearch.jade @@ -18,13 +18,13 @@ template(name="globalSearch") .global-search-dueat-list-wrapper h1 if $eq resultsCount.get 0 - | {{_ 'no-results' }} + | {{_ 'no-cards-found' }} else if $eq resultsCount.get 1 - | {{_ 'one-result' }} + | {{_ 'one-card-found' }} else if $eq resultsCount.get totalHits.get - | {{_ 'n-results' resultsCount.get }} + | {{_ 'n-cards-found' resultsCount.get }} else - | {{_ 'n-of-n-results' resultsCount.get totalHits.get }} + | {{_ 'n-n-of-n-cards-found' 1 resultsCount.get totalHits.get }} if queryErrors.get div each msg in errorMessages diff --git a/client/components/main/globalSearch.js b/client/components/main/globalSearch.js index 982c8e89a..560cf9dda 100644 --- a/client/components/main/globalSearch.js +++ b/client/components/main/globalSearch.js @@ -51,7 +51,9 @@ BlazeComponent.extendComponent({ if (this.queryParams) { const results = Cards.globalSearch(this.queryParams); // eslint-disable-next-line no-console - console.log('count:', results.count); + // console.log('user:', Meteor.user()); + // eslint-disable-next-line no-console + // console.log('user:', Meteor.user().sessionData); // console.log('errors:', results.errors); this.totalHits.set(Meteor.user().sessionData.totalHits); this.resultsCount.set(results.cards.count()); @@ -103,10 +105,8 @@ BlazeComponent.extendComponent({ // eslint-disable-next-line no-console // console.log('query:', query); - const reUser = /^@(?[\w.:]+)(\s+|$)/; - const reLabel = /^#(?