diff options
Diffstat (limited to 'pkg/app/list')
-rw-r--r-- | pkg/app/list/show.go | 7 | ||||
-rw-r--r-- | pkg/app/list/threads.go | 7 | ||||
-rw-r--r-- | pkg/app/list/utils.go | 18 |
3 files changed, 0 insertions, 32 deletions
diff --git a/pkg/app/list/show.go b/pkg/app/list/show.go index 5231b5b..79ea8f2 100644 --- a/pkg/app/list/show.go +++ b/pkg/app/list/show.go @@ -31,13 +31,6 @@ func ComputeShowTemplateData(listName string) interface{} { WhereOr(`subject LIKE 'Re: [` + listName + `]%'`) return q, nil }). - //WhereGroup(func(q *orm.Query) (*orm.Query, error) { - // q = q.WhereOr(`to LIKE '%` + listName + `@lists.gentoo.org%'`). - // WhereOr(`cc LIKE '%` + listName + `@lists.gentoo.org%'`). - // WhereOr(`to LIKE '%` + listName + `@gentoo.org%'`). - // WhereOr(`cc LIKE '%` + listName + `@gentoo.org%'`) - // return q, nil - //}). ColumnExpr("to_char(date, 'YYYY-MM') AS combined_date"). ColumnExpr("count(*) AS message_count"). Group("combined_date"). diff --git a/pkg/app/list/threads.go b/pkg/app/list/threads.go index c069673..dfc9694 100644 --- a/pkg/app/list/threads.go +++ b/pkg/app/list/threads.go @@ -40,13 +40,6 @@ func Threads(w http.ResponseWriter, r *http.Request) { WhereOr(`subject LIKE 'Re: [` + listName + `]%'`) return q, nil }). - //WhereGroup(func(q *orm.Query) (*orm.Query, error) { - // q = q.WhereOr(`headers::jsonb->>'To' LIKE '%` + listName + `@lists.gentoo.org%'`). - // WhereOr(`headers::jsonb->>'Cc' LIKE '%` + listName + `@lists.gentoo.org%'`). - // WhereOr(`headers::jsonb->>'To' LIKE '%` + listName + `@gentoo.org%'`). - // WhereOr(`headers::jsonb->>'Cc' LIKE '%` + listName + `@gentoo.org%'`) - // return q, nil - //}). Order("date DESC") messagesCount, _ := query.Count() diff --git a/pkg/app/list/utils.go b/pkg/app/list/utils.go index 07dbc65..8a9e964 100644 --- a/pkg/app/list/utils.go +++ b/pkg/app/list/utils.go @@ -3,9 +3,7 @@ package list import ( - "archives/pkg/database" "archives/pkg/models" - "github.com/go-pg/pg/v10/orm" "html/template" "net/http" ) @@ -119,19 +117,3 @@ func makeRange(min, max int) []int { } return a } - -func countMessages(listName string) (int, error) { - return database.DBCon.Model((*models.Message)(nil)). - WhereGroup(func(q *orm.Query) (*orm.Query, error) { - q = q.WhereOr(`(headers::jsonb->>'Subject')::jsonb->>0 LIKE '[` + listName + `]%'`). - WhereOr(`(headers::jsonb->>'Subject')::jsonb->>0 LIKE 'Re: [` + listName + `]%'`) - return q, nil - }). - WhereGroup(func(q *orm.Query) (*orm.Query, error) { - q = q.WhereOr(`headers::jsonb->>'To' LIKE '%` + listName + `@lists.gentoo.org%'`). - WhereOr(`headers::jsonb->>'Cc' LIKE '%` + listName + `@lists.gentoo.org%'`). - WhereOr(`headers::jsonb->>'To' LIKE '%` + listName + `@gentoo.org%'`). - WhereOr(`headers::jsonb->>'Cc' LIKE '%` + listName + `@gentoo.org%'`) - return q, nil - }).Count() -} |