diff options
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) } |