diff options
author | FChannel <=> | 2021-01-28 21:26:55 -0800 |
---|---|---|
committer | FChannel <=> | 2021-01-28 21:26:55 -0800 |
commit | e8cfabbfa36dd9cba293b7015a55c371edf3d1d6 (patch) | |
tree | b5835afc9b441e390ce7257c52d0a1ec968e44fc /client.go | |
parent | 74f5fb1e96e4c18d87ffe6838f4ab448c184ccff (diff) |
quick fix for post and attachment count
Diffstat (limited to 'client.go')
-rw-r--r-- | client.go | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -187,6 +187,12 @@ func OutboxGet(w http.ResponseWriter, r *http.Request, db *sql.DB, collection Co orderedReplies = append(orderedReplies, replies[cur]) } } + + for _, e := range returnData.Posts[i].Replies.OrderedItems { + if len(e.Attachment) > 0 { + returnData.Posts[i].Replies.TotalImgs = returnData.Posts[i].Replies.TotalImgs + 1 + } + } returnData.Posts[i].Replies.TotalItems = len(returnData.Posts[i].Replies.OrderedItems) returnData.Posts[i].Replies.OrderedItems = orderedReplies @@ -253,6 +259,15 @@ func CatalogGet(w http.ResponseWriter, r *http.Request, db *sql.DB, collection C returnData.Posts = mergeCollection.OrderedItems + for i, _ := range returnData.Posts { + for _, e := range returnData.Posts[i].Replies.OrderedItems { + if len(e.Attachment) > 0 { + returnData.Posts[i].Replies.TotalImgs = returnData.Posts[i].Replies.TotalImgs + 1 + } + } + returnData.Posts[i].Replies.TotalItems = len(returnData.Posts[i].Replies.OrderedItems) + } + t.ExecuteTemplate(w, "layout", returnData) } @@ -340,6 +355,15 @@ func PostGet(w http.ResponseWriter, r *http.Request, db *sql.DB){ } } + for i, _ := range returnData.Posts { + for _, e := range returnData.Posts[i].Replies.OrderedItems { + if len(e.Attachment) > 0 { + returnData.Posts[i].Replies.TotalImgs = returnData.Posts[i].Replies.TotalImgs + 1 + } + } + returnData.Posts[i].Replies.TotalItems = len(returnData.Posts[i].Replies.OrderedItems) + } + t.ExecuteTemplate(w, "layout", returnData) } |