diff --git a/internal/core/subscribers.go b/internal/core/subscribers.go index 597ad44..bb4eea8 100644 --- a/internal/core/subscribers.go +++ b/internal/core/subscribers.go @@ -356,7 +356,7 @@ func (c *Core) BlocklistSubscribers(subIDs []int) error { // BlocklistSubscribersByQuery blocklists the given list of subscribers. func (c *Core) BlocklistSubscribersByQuery(query string, listIDs []int) error { - if err := c.q.ExecSubscriberQueryTpl(sanitizeSQLExp(query), c.q.BlocklistSubscribersByQuery, listIDs, c.db); err != nil { + if err := c.q.ExecSubQueryTpl(sanitizeSQLExp(query), c.q.BlocklistSubscribersByQuery, listIDs, c.db); err != nil { c.log.Printf("error blocklisting subscribers: %v", err) return echo.NewHTTPError(http.StatusInternalServerError, c.i18n.Ts("subscribers.errorBlocklisting", "error", pqErrMsg(err))) @@ -385,7 +385,7 @@ func (c *Core) DeleteSubscribers(subIDs []int, subUUIDs []string) error { // DeleteSubscribersByQuery deletes subscribers by a given arbitrary query expression. func (c *Core) DeleteSubscribersByQuery(query string, listIDs []int) error { - err := c.q.ExecSubscriberQueryTpl(sanitizeSQLExp(query), c.q.DeleteSubscribersByQuery, listIDs, c.db) + err := c.q.ExecSubQueryTpl(sanitizeSQLExp(query), c.q.DeleteSubscribersByQuery, listIDs, c.db) if err != nil { c.log.Printf("error deleting subscribers: %v", err) return echo.NewHTTPError(http.StatusInternalServerError, diff --git a/internal/core/subscriptions.go b/internal/core/subscriptions.go index b438db0..db2e4ce 100644 --- a/internal/core/subscriptions.go +++ b/internal/core/subscriptions.go @@ -25,7 +25,7 @@ func (c *Core) AddSubscriptionsByQuery(query string, sourceListIDs, targetListID sourceListIDs = []int{} } - err := c.q.ExecSubscriberQueryTpl(sanitizeSQLExp(query), c.q.AddSubscribersToListsByQuery, sourceListIDs, c.db, pq.Array(targetListIDs)) + err := c.q.ExecSubQueryTpl(sanitizeSQLExp(query), c.q.AddSubscribersToListsByQuery, sourceListIDs, c.db, pq.Array(targetListIDs)) if err != nil { c.log.Printf("error adding subscriptions by query: %v", err) return echo.NewHTTPError(http.StatusInternalServerError, @@ -54,7 +54,7 @@ func (c *Core) DeleteSubscriptionsByQuery(query string, sourceListIDs, targetLis sourceListIDs = []int{} } - err := c.q.ExecSubscriberQueryTpl(sanitizeSQLExp(query), c.q.DeleteSubscriptionsByQuery, sourceListIDs, c.db, pq.Array(targetListIDs)) + err := c.q.ExecSubQueryTpl(sanitizeSQLExp(query), c.q.DeleteSubscriptionsByQuery, sourceListIDs, c.db, pq.Array(targetListIDs)) if err != nil { c.log.Printf("error deleting subscriptions by query: %v", err) return echo.NewHTTPError(http.StatusInternalServerError, @@ -82,7 +82,7 @@ func (c *Core) UnsubscribeListsByQuery(query string, sourceListIDs, targetListID sourceListIDs = []int{} } - err := c.q.ExecSubscriberQueryTpl(sanitizeSQLExp(query), c.q.UnsubscribeSubscribersFromListsByQuery, sourceListIDs, c.db, pq.Array(targetListIDs)) + err := c.q.ExecSubQueryTpl(sanitizeSQLExp(query), c.q.UnsubscribeSubscribersFromListsByQuery, sourceListIDs, c.db, pq.Array(targetListIDs)) if err != nil { c.log.Printf("error unsubscriging from lists by query: %v", err) return echo.NewHTTPError(http.StatusInternalServerError, diff --git a/models/queries.go b/models/queries.go index 0904aad..aeece0d 100644 --- a/models/queries.go +++ b/models/queries.go @@ -126,7 +126,7 @@ func (q *Queries) CompileSubscriberQueryTpl(exp string, db *sqlx.DB) (string, er // compileSubscriberQueryTpl takes an arbitrary WHERE expressions and a subscriber // query template that depends on the filter (eg: delete by query, blocklist by query etc.) // combines and executes them. -func (q *Queries) ExecSubscriberQueryTpl(exp, tpl string, listIDs []int, db *sqlx.DB, args ...interface{}) error { +func (q *Queries) ExecSubQueryTpl(exp, tpl string, listIDs []int, db *sqlx.DB, args ...interface{}) error { // Perform a dry run. filterExp, err := q.CompileSubscriberQueryTpl(exp, db) if err != nil {