mirror of
https://github.com/writeas/writefreely
synced 2025-02-03 14:37:32 +01:00
Fix Novel blog post order in feeds and outbox
This commit is contained in:
parent
2ad2270973
commit
b58cb1e541
@ -117,7 +117,7 @@ func handleFetchCollectionOutbox(app *app, w http.ResponseWriter, r *http.Reques
|
|||||||
ocp := activitystreams.NewOrderedCollectionPage(accountRoot, "outbox", res.TotalPosts, p)
|
ocp := activitystreams.NewOrderedCollectionPage(accountRoot, "outbox", res.TotalPosts, p)
|
||||||
ocp.OrderedItems = []interface{}{}
|
ocp.OrderedItems = []interface{}{}
|
||||||
|
|
||||||
posts, err := app.db.GetPosts(c, p, false)
|
posts, err := app.db.GetPosts(c, p, false, true)
|
||||||
for _, pp := range *posts {
|
for _, pp := range *posts {
|
||||||
pp.Collection = res
|
pp.Collection = res
|
||||||
o := pp.ActivityObject()
|
o := pp.ActivityObject()
|
||||||
|
@ -483,7 +483,7 @@ func fetchCollectionPosts(app *app, w http.ResponseWriter, r *http.Request) erro
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
posts, err := app.db.GetPosts(c, page, isCollOwner)
|
posts, err := app.db.GetPosts(c, page, isCollOwner, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -714,7 +714,7 @@ func handleViewCollection(app *app, w http.ResponseWriter, r *http.Request) erro
|
|||||||
return impart.HTTPError{http.StatusFound, redirURL}
|
return impart.HTTPError{http.StatusFound, redirURL}
|
||||||
}
|
}
|
||||||
|
|
||||||
coll.Posts, _ = app.db.GetPosts(c, page, cr.isCollOwner)
|
coll.Posts, _ = app.db.GetPosts(c, page, cr.isCollOwner, false)
|
||||||
|
|
||||||
// Serve collection
|
// Serve collection
|
||||||
displayPage := CollectionPage{
|
displayPage := CollectionPage{
|
||||||
|
@ -86,7 +86,7 @@ type writestore interface {
|
|||||||
ClaimPosts(userID int64, collAlias string, posts *[]ClaimPostRequest) (*[]ClaimPostResult, error)
|
ClaimPosts(userID int64, collAlias string, posts *[]ClaimPostRequest) (*[]ClaimPostResult, error)
|
||||||
|
|
||||||
GetPostsCount(c *CollectionObj, includeFuture bool)
|
GetPostsCount(c *CollectionObj, includeFuture bool)
|
||||||
GetPosts(c *Collection, page int, includeFuture bool) (*[]PublicPost, error)
|
GetPosts(c *Collection, page int, includeFuture, forceRecentFirst bool) (*[]PublicPost, error)
|
||||||
GetPostsTagged(c *Collection, tag string, page int, includeFuture bool) (*[]PublicPost, error)
|
GetPostsTagged(c *Collection, tag string, page int, includeFuture bool) (*[]PublicPost, error)
|
||||||
|
|
||||||
GetAPFollowers(c *Collection) (*[]RemoteUser, error)
|
GetAPFollowers(c *Collection) (*[]RemoteUser, error)
|
||||||
@ -986,12 +986,12 @@ func (db *datastore) GetPostsCount(c *CollectionObj, includeFuture bool) {
|
|||||||
// GetPosts retrieves all standard (non-pinned) posts for the given Collection.
|
// GetPosts retrieves all standard (non-pinned) posts for the given Collection.
|
||||||
// It will return future posts if `includeFuture` is true.
|
// It will return future posts if `includeFuture` is true.
|
||||||
// TODO: change includeFuture to isOwner, since that's how it's used
|
// TODO: change includeFuture to isOwner, since that's how it's used
|
||||||
func (db *datastore) GetPosts(c *Collection, page int, includeFuture bool) (*[]PublicPost, error) {
|
func (db *datastore) GetPosts(c *Collection, page int, includeFuture, forceRecentFirst bool) (*[]PublicPost, error) {
|
||||||
collID := c.ID
|
collID := c.ID
|
||||||
|
|
||||||
cf := c.NewFormat()
|
cf := c.NewFormat()
|
||||||
order := "DESC"
|
order := "DESC"
|
||||||
if cf.Ascending() {
|
if cf.Ascending() && !forceRecentFirst {
|
||||||
order = "ASC"
|
order = "ASC"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ func compileFullExport(app *app, u *User) *ExportUser {
|
|||||||
var collObjs []CollectionObj
|
var collObjs []CollectionObj
|
||||||
for _, c := range *colls {
|
for _, c := range *colls {
|
||||||
co := &CollectionObj{Collection: c}
|
co := &CollectionObj{Collection: c}
|
||||||
co.Posts, err = app.db.GetPosts(&c, 0, true)
|
co.Posts, err = app.db.GetPosts(&c, 0, true, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("unable to get collection posts: %v", err)
|
log.Error("unable to get collection posts: %v", err)
|
||||||
}
|
}
|
||||||
|
2
feed.go
2
feed.go
@ -46,7 +46,7 @@ func ViewFeed(app *app, w http.ResponseWriter, req *http.Request) error {
|
|||||||
if tag != "" {
|
if tag != "" {
|
||||||
coll.Posts, _ = app.db.GetPostsTagged(c, tag, 1, false)
|
coll.Posts, _ = app.db.GetPostsTagged(c, tag, 1, false)
|
||||||
} else {
|
} else {
|
||||||
coll.Posts, _ = app.db.GetPosts(c, 1, false)
|
coll.Posts, _ = app.db.GetPosts(c, 1, false, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
author := ""
|
author := ""
|
||||||
|
@ -54,7 +54,7 @@ func handleViewSitemap(app *app, w http.ResponseWriter, r *http.Request) error {
|
|||||||
host = c.CanonicalURL()
|
host = c.CanonicalURL()
|
||||||
|
|
||||||
sm := buildSitemap(host, pre)
|
sm := buildSitemap(host, pre)
|
||||||
posts, err := app.db.GetPosts(c, 0, false)
|
posts, err := app.db.GetPosts(c, 0, false, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Error getting posts: %v", err)
|
log.Error("Error getting posts: %v", err)
|
||||||
return err
|
return err
|
||||||
|
Loading…
x
Reference in New Issue
Block a user