aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Magorsch <arzano@gentoo.org>2020-06-23 15:46:59 +0200
committerMax Magorsch <arzano@gentoo.org>2020-06-23 15:46:59 +0200
commit55301d30a5c47291cafe84f483324510ee9151b4 (patch)
tree4fdabd11c8788568bf37c6b15cf5072d72ca30ec /pkg/app/popular
parentImprove the importer further (diff)
downloadarchives-55301d30a5c47291cafe84f483324510ee9151b4.tar.gz
archives-55301d30a5c47291cafe84f483324510ee9151b4.tar.bz2
archives-55301d30a5c47291cafe84f483324510ee9151b4.zip
Clean up the code
Signed-off-by: Max Magorsch <arzano@gentoo.org>
Diffstat (limited to 'pkg/app/popular')
-rw-r--r--pkg/app/popular/utils.go23
1 files changed, 0 insertions, 23 deletions
diff --git a/pkg/app/popular/utils.go b/pkg/app/popular/utils.go
index bc2a12f..5af1c2f 100644
--- a/pkg/app/popular/utils.go
+++ b/pkg/app/popular/utils.go
@@ -5,7 +5,6 @@ import (
"archives/pkg/models"
"html/template"
"net/http"
- "strconv"
)
// renderIndexTemplate renders all templates used for the landing page
@@ -13,13 +12,6 @@ func renderPopularThreads(w http.ResponseWriter, templateData interface{}) {
templates := template.Must(
template.Must(
template.New("Popular").
- Funcs(template.FuncMap{
- "makeMessage": func(headers map[string][]string) models.Message {
- return models.Message{
- //Headers: headers,
- }
- },
- }).
ParseGlob("web/templates/layout/*.tmpl")).
ParseGlob("web/templates/popular/*.tmpl"))
@@ -39,18 +31,3 @@ func GetPopularThreads(n int, date string) ([]*models.Message, error) {
return recentMessages, err
}
-
-func GetMessagesFromPopularThreads(threads models.Threads) []*models.Message {
- var popularThreads []*models.Message
- for _, thread := range threads {
- var messages []*models.Message
- err := database.DBCon.Model(&messages).
- Where(`headers::jsonb->>'Subject' LIKE '%` + thread.Id + `%'`).
- Select()
- if err == nil && len(messages) > 0 {
- messages[0].Comment = strconv.Itoa(thread.Count)
- popularThreads = append(popularThreads, messages[0])
- }
- }
- return popularThreads
-}