diff options
Diffstat (limited to 'pkg/app/list/messages.go')
-rw-r--r-- | pkg/app/list/messages.go | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/pkg/app/list/messages.go b/pkg/app/list/messages.go index 383e891..7a78811 100644 --- a/pkg/app/list/messages.go +++ b/pkg/app/list/messages.go @@ -33,20 +33,20 @@ func Messages(w http.ResponseWriter, r *http.Request) { var messages []*models.Message query := database.DBCon.Model(&messages). - Column("id", "headers", "date"). + Column("id", "subject", "from", "date"). Where("to_char(date, 'YYYY-MM') = ?", combinedDate). 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%'`) + q = q.WhereOr(`subject LIKE '[` + listName + `]%'`). + 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() |