From 79afb5fc9c4a52f5ad26e8968a0f95bde51c5944 Mon Sep 17 00:00:00 2001 From: Kevin Ansfield Date: Thu, 10 Mar 2022 16:45:18 +0000 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Added=20"Name"=20and=20"Email"=20fi?= =?UTF-8?q?lters=20to=20members=20screen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit closes https://github.com/TryGhost/Team/issues/1408 closes https://github.com/TryGhost/Team/issues/1409 - adds new text-based filters that match against member names and emails that allows more specific filtering than search - new filter operators introduced for "contains", "does not contain", "starts with", and "ends with" --- ghost/admin/app/components/members/filter.js | 71 ++++++------------- ghost/admin/app/services/feature.js | 3 - ghost/admin/app/templates/settings/labs.hbs | 13 ---- .../tests/acceptance/members/filter-test.js | 1 - 4 files changed, 22 insertions(+), 66 deletions(-) diff --git a/ghost/admin/app/components/members/filter.js b/ghost/admin/app/components/members/filter.js index 0f81576564..3562d34f23 100644 --- a/ghost/admin/app/components/members/filter.js +++ b/ghost/admin/app/components/members/filter.js @@ -9,8 +9,8 @@ import {tracked} from '@glimmer/tracking'; const FILTER_PROPERTIES = [ // Basic - {label: 'Name', name: 'name', group: 'Basic', valueType: 'text', feature: 'membersContainsFilters'}, - {label: 'Email', name: 'email', group: 'Basic', valueType: 'text', feature: 'membersContainsFilters'}, + {label: 'Name', name: 'name', group: 'Basic', valueType: 'text'}, + {label: 'Email', name: 'email', group: 'Basic', valueType: 'text'}, // {label: 'Location', name: 'location', group: 'Basic'}, {label: 'Label', name: 'label', group: 'Basic', valueType: 'array'}, {label: 'Newsletter subscription', name: 'subscribed', group: 'Basic'}, @@ -141,23 +141,14 @@ export default class MembersFilter extends Component { @service settings; @service store; - @tracked filters = this.feature.membersContainsFilters - ? new TrackedArray([ - new Filter({ - type: 'name', - relation: 'is', - value: '', - relationOptions: FILTER_RELATIONS_OPTIONS.name - }) - ]) - : new TrackedArray([ - new Filter({ - type: 'label', - relation: 'is', - value: [], - relationOptions: FILTER_RELATIONS_OPTIONS.label - }) - ]); + @tracked filters = new TrackedArray([ + new Filter({ + type: 'name', + relation: 'is', + value: '', + relationOptions: FILTER_RELATIONS_OPTIONS.name + }) + ]); availableFilterRelationsOptions = FILTER_RELATIONS_OPTIONS; availableFilterValueOptions = FILTER_VALUE_OPTIONS; @@ -204,21 +195,12 @@ export default class MembersFilter extends Component { @action addFilter() { - if (this.feature.membersContainsFilters) { - this.filters.push(new Filter({ - type: 'name', - relation: 'is', - value: '', - relationOptions: FILTER_RELATIONS_OPTIONS.name - })); - } else { - this.filters.push(new Filter({ - type: 'label', - relation: 'is', - value: [], - relationOptions: FILTER_RELATIONS_OPTIONS.label - })); - } + this.filters.push(new Filter({ + type: 'name', + relation: 'is', + value: '', + relationOptions: FILTER_RELATIONS_OPTIONS.name + })); this.applySoftFilter(); } @@ -503,21 +485,12 @@ export default class MembersFilter extends Component { resetFilter() { const filters = []; - if (this.feature.membersContainsFilters) { - filters.push(new Filter({ - type: 'name', - relation: 'is', - value: '', - relationOptions: FILTER_RELATIONS_OPTIONS.name - })); - } else { - filters.push(new Filter({ - type: 'label', - relation: 'is', - value: [], - relationOptions: FILTER_RELATIONS_OPTIONS.label - })); - } + filters.push(new Filter({ + type: 'name', + relation: 'is', + value: '', + relationOptions: FILTER_RELATIONS_OPTIONS.name + })); this.filters = new TrackedArray(filters); this.args.onResetFilter(); diff --git a/ghost/admin/app/services/feature.js b/ghost/admin/app/services/feature.js index b84e794b2f..aaebe0c811 100644 --- a/ghost/admin/app/services/feature.js +++ b/ghost/admin/app/services/feature.js @@ -90,9 +90,6 @@ export default class FeatureService extends Service { @feature('membersTableStatus') membersTableStatus; - @feature('membersContainsFilters') - membersContainsFilters; - @feature('selectablePortalLinks') selectablePortalLinks; diff --git a/ghost/admin/app/templates/settings/labs.hbs b/ghost/admin/app/templates/settings/labs.hbs index 118f977d26..de7c635964 100644 --- a/ghost/admin/app/templates/settings/labs.hbs +++ b/ghost/admin/app/templates/settings/labs.hbs @@ -326,19 +326,6 @@ -
-
-
-

Members "Contains" filters

-

- Filter members by matching parts of their name and email fields -

-
-
- -
-
-
{{/if}} diff --git a/ghost/admin/tests/acceptance/members/filter-test.js b/ghost/admin/tests/acceptance/members/filter-test.js index f3b08a0fb7..f7943650db 100644 --- a/ghost/admin/tests/acceptance/members/filter-test.js +++ b/ghost/admin/tests/acceptance/members/filter-test.js @@ -19,7 +19,6 @@ describe('Acceptance: Members filtering', function () { beforeEach(async function () { this.server.loadFixtures('configs'); this.server.loadFixtures('settings'); - enableLabsFlag(this.server, 'membersContainsFilters'); enableLabsFlag(this.server, 'multipleProducts'); // test with stripe connected and email turned on