Skip to content

Commit 2e56322

Browse files
committed
Fix incorrect query check in bulk subscriber actions. Closes #2491.
1 parent 00a7eff commit 2e56322

File tree

2 files changed

+1
-7
lines changed

2 files changed

+1
-7
lines changed

cmd/subscribers.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -458,9 +458,6 @@ func (a *App) BlocklistSubscribersByQuery(c echo.Context) error {
458458

459459
req.Search = strings.TrimSpace(req.Search)
460460
req.Query = formatSQLExp(req.Query)
461-
if req.Search == "" && req.Query == "" {
462-
return echo.NewHTTPError(http.StatusBadRequest, a.i18n.Ts("globals.messages.invalidFields", "name", "query"))
463-
}
464461

465462
// Does the user have the subscribers:sql_query permission?
466463
if req.Query != "" {
@@ -495,9 +492,6 @@ func (a *App) ManageSubscriberListsByQuery(c echo.Context) error {
495492

496493
req.Search = strings.TrimSpace(req.Search)
497494
req.Query = formatSQLExp(req.Query)
498-
if req.Search == "" && req.Query == "" {
499-
return echo.NewHTTPError(http.StatusBadRequest, a.i18n.Ts("globals.messages.invalidFields", "name", "query"))
500-
}
501495

502496
// Does the user have the subscribers:sql_query permission?
503497
if req.Query != "" {

frontend/src/views/Subscribers.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ export default Vue.extend({
452452
this.$api.deleteSubscribersByQuery({
453453
// If the query expression is empty, explicitly pass `all=true`
454454
// so that the backend deletes all records in the DB with an empty query string.
455-
all: this.queryParams.queryExp.trim() === '',
455+
all: this.queryParams.queryExp.trim() === '' && this.queryParams.search.trim() === '',
456456
search: this.queryParams.search,
457457
query: this.queryParams.queryExp,
458458
list_ids: this.queryParams.listID ? [this.queryParams.listID] : null,

0 commit comments

Comments
 (0)