mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
🐛 Fixed member search ignoring filters (#18600)
fixes TryGhost/Product#3792 - Previously, if you had a filter set in the members list (e.g. `status=paid`), then you searched for a member by email address, the original filter would be ignored, and any members matching the search would be returned, regardless of whether they matched the filters. Effectively, the logic was `member matches filters OR member matches search`. To make this worse, the UI still showed both the filters and the search query, leading to confusing results. - This small change to the backend logic changes the behavior to only return members that match the filter AND the search query, so if you search for a member that does not meet the current filters, they will not be returned.
This commit is contained in:
parent
f0efbb7fbb
commit
cd4ca3c933
1 changed files with 4 additions and 2 deletions
|
@ -373,8 +373,10 @@ const Member = ghostBookshelf.Model.extend({
|
|||
},
|
||||
|
||||
searchQuery: function searchQuery(queryBuilder, query) {
|
||||
queryBuilder.where('members.name', 'like', `%${query}%`);
|
||||
queryBuilder.orWhere('members.email', 'like', `%${query}%`);
|
||||
queryBuilder.where(function () {
|
||||
this.where('members.name', 'like', `%${query}%`)
|
||||
.orWhere('members.email', 'like', `%${query}%`);
|
||||
});
|
||||
},
|
||||
|
||||
orderRawQuery(field, direction) {
|
||||
|
|
Loading…
Add table
Reference in a new issue