Skip to content

High performance, self-hosted, newsletter and mailing list manager with a modern dashboard. Single binary app.

Fix incorrect query check in bulk subscriber actions. Closes #2491.

Kailash Nadh2e563229dae3
diff --git a/cmd/subscribers.go b/cmd/subscribers.go
index 306ef6ca..7675f1f6 100644
--- a/cmd/subscribers.go
+++ b/cmd/subscribers.go
@@ -458,9 +458,6 @@ func (a *App) BlocklistSubscribersByQuery(c echo.Context) error {
req.Search = strings.TrimSpace(req.Search)
req.Query = formatSQLExp(req.Query)
- if req.Search == "" && req.Query == "" {
- return echo.NewHTTPError(http.StatusBadRequest, a.i18n.Ts("globals.messages.invalidFields", "name", "query"))
- }
// Does the user have the subscribers:sql_query permission?
if req.Query != "" {
@@ -495,9 +492,6 @@ func (a *App) ManageSubscriberListsByQuery(c echo.Context) error {
req.Search = strings.TrimSpace(req.Search)
req.Query = formatSQLExp(req.Query)
- if req.Search == "" && req.Query == "" {
- return echo.NewHTTPError(http.StatusBadRequest, a.i18n.Ts("globals.messages.invalidFields", "name", "query"))
- }
// Does the user have the subscribers:sql_query permission?
if req.Query != "" {
diff --git a/frontend/src/views/Subscribers.vue b/frontend/src/views/Subscribers.vue
index 449708c4..c83d180a 100644
--- a/frontend/src/views/Subscribers.vue
+++ b/frontend/src/views/Subscribers.vue
@@ -452,7 +452,7 @@ export default Vue.extend({
this.$api.deleteSubscribersByQuery({
// If the query expression is empty, explicitly pass `all=true`
// so that the backend deletes all records in the DB with an empty query string.
- all: this.queryParams.queryExp.trim() === '',
+ all: this.queryParams.queryExp.trim() === '' && this.queryParams.search.trim() === '',
search: this.queryParams.search,
query: this.queryParams.queryExp,
list_ids: this.queryParams.listID ? [this.queryParams.listID] : null,