feat(media): unify uploads onto modules/album, add batched srcset enrichment and Media Library picker
This commit is contained in:
@@ -202,8 +202,15 @@ func AuthorPosts(app *backpack.App) http.HandlerFunc {
|
||||
return
|
||||
}
|
||||
rows := make([]map[string]any, 0, len(posts))
|
||||
postPtrs := make([]*models.Post, len(posts))
|
||||
trs := make([]any, len(posts))
|
||||
for i := range posts {
|
||||
rows = append(rows, serializePost(&posts[i], db))
|
||||
postPtrs[i] = &posts[i]
|
||||
trs[i] = translationsOf(db, &posts[i])
|
||||
}
|
||||
media := batchLoadPostMedia(r.Context(), db, app, postPtrs, trs)
|
||||
for i := range posts {
|
||||
rows = append(rows, serializePostWithMedia(&posts[i], db, trs[i], media))
|
||||
}
|
||||
wire.WriteJSON(w, http.StatusOK, lagoon.Paginate(rows, page, perPage, total))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user