Pārlūkot izejas kodu

Fix collection rendering in Chorus mode

pull/463/head
Matt Baer pirms 2 gadiem
vecāks
revīzija
c05f7056c4
2 mainītis faili ar 9 papildinājumiem un 1 dzēšanām
  1. +4
    -0
      collections.go
  2. +5
    -1
      posts.go

+ 4
- 0
collections.go Parādīt failu

@@ -582,6 +582,9 @@ type CollectionPage struct {
PinnedPosts *[]PublicPost
IsAdmin bool
CanInvite bool

// Helper field for Chorus mode
CollAlias string
}

func NewCollectionObj(c *Collection) *CollectionObj {
@@ -818,6 +821,7 @@ func handleViewCollection(app *App, w http.ResponseWriter, r *http.Request) erro
StaticPage: pageForReq(app, r),
IsCustomDomain: cr.isCustomDomain,
IsWelcome: r.FormValue("greeting") != "",
CollAlias: c.Alias,
}
displayPage.IsAdmin = u != nil && u.IsAdmin()
displayPage.CanInvite = canUserInvite(app.cfg, displayPage.IsAdmin)


+ 5
- 1
posts.go Parādīt failu

@@ -144,6 +144,9 @@ type (
IsAdmin bool
CanInvite bool
Silenced bool

// Helper field for Chorus mode
CollAlias string
}

RawPost struct {
@@ -1536,6 +1539,7 @@ Are you sure it was ever here?`,
IsCustomDomain: cr.isCustomDomain,
IsFound: postFound,
Silenced: silenced,
CollAlias: c.Alias,
}
tp.IsAdmin = u != nil && u.IsAdmin()
tp.CanInvite = canUserInvite(app.cfg, tp.IsAdmin)
@@ -1551,7 +1555,7 @@ Are you sure it was ever here?`,
postTmpl = "chorus-collection-post"
}
if err := templates[postTmpl].ExecuteTemplate(w, "post", tp); err != nil {
log.Error("Error in collection-post template: %v", err)
log.Error("Error in %s template: %v", postTmpl, err)
}
}



Notiek ielāde…
Atcelt
Saglabāt