Procházet zdrojové kódy

Fix Novel blog post order in feeds and outbox

tags/v0.3.0
Matt Baer před 5 roky
rodič
revize
b58cb1e541
6 změnil soubory, kde provedl 9 přidání a 9 odebrání
  1. +1
    -1
      activitypub.go
  2. +2
    -2
      collections.go
  3. +3
    -3
      database.go
  4. +1
    -1
      export.go
  5. +1
    -1
      feed.go
  6. +1
    -1
      sitemap.go

+ 1
- 1
activitypub.go Zobrazit soubor

@@ -117,7 +117,7 @@ func handleFetchCollectionOutbox(app *app, w http.ResponseWriter, r *http.Reques
ocp := activitystreams.NewOrderedCollectionPage(accountRoot, "outbox", res.TotalPosts, p)
ocp.OrderedItems = []interface{}{}

posts, err := app.db.GetPosts(c, p, false)
posts, err := app.db.GetPosts(c, p, false, true)
for _, pp := range *posts {
pp.Collection = res
o := pp.ActivityObject()


+ 2
- 2
collections.go Zobrazit soubor

@@ -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 {
return err
}
@@ -714,7 +714,7 @@ func handleViewCollection(app *app, w http.ResponseWriter, r *http.Request) erro
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
displayPage := CollectionPage{


+ 3
- 3
database.go Zobrazit soubor

@@ -86,7 +86,7 @@ type writestore interface {
ClaimPosts(userID int64, collAlias string, posts *[]ClaimPostRequest) (*[]ClaimPostResult, error)

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)

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.
// It will return future posts if `includeFuture` is true.
// 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

cf := c.NewFormat()
order := "DESC"
if cf.Ascending() {
if cf.Ascending() && !forceRecentFirst {
order = "ASC"
}



+ 1
- 1
export.go Zobrazit soubor

@@ -101,7 +101,7 @@ func compileFullExport(app *app, u *User) *ExportUser {
var collObjs []CollectionObj
for _, c := range *colls {
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 {
log.Error("unable to get collection posts: %v", err)
}


+ 1
- 1
feed.go Zobrazit soubor

@@ -46,7 +46,7 @@ func ViewFeed(app *app, w http.ResponseWriter, req *http.Request) error {
if tag != "" {
coll.Posts, _ = app.db.GetPostsTagged(c, tag, 1, false)
} else {
coll.Posts, _ = app.db.GetPosts(c, 1, false)
coll.Posts, _ = app.db.GetPosts(c, 1, false, true)
}

author := ""


+ 1
- 1
sitemap.go Zobrazit soubor

@@ -54,7 +54,7 @@ func handleViewSitemap(app *app, w http.ResponseWriter, r *http.Request) error {
host = c.CanonicalURL()

sm := buildSitemap(host, pre)
posts, err := app.db.GetPosts(c, 0, false)
posts, err := app.db.GetPosts(c, 0, false, false)
if err != nil {
log.Error("Error getting posts: %v", err)
return err


Načítá se…
Zrušit
Uložit