Show unlisted and private posts for logged-in users in map (#18)

pull/31/head
Jan-Lukas Else 2 weeks ago
parent e8189acb40
commit d186f2e956
  1. 7
      authentication.go
  2. 6
      geoMap.go
  3. 5
      posts.go

@ -175,3 +175,10 @@ func (a *goBlog) serveLogout(w http.ResponseWriter, r *http.Request) {
}
http.Redirect(w, r, "/", http.StatusFound)
}
func (a *goBlog) getDefaultPostStatusse(r *http.Request) []postStatus {
if a.isLoggedIn(r) {
return []postStatus{statusPublished, statusUnlisted, statusPrivate}
}
return []postStatus{statusPublished}
}

@ -19,7 +19,7 @@ func (a *goBlog) serveGeoMap(w http.ResponseWriter, r *http.Request) {
allPostsWithLocation, err := a.db.countPosts(&postsRequestConfig{
blog: blog,
status: statusPublished,
statusse: a.getDefaultPostStatusse(r),
parameters: []string{a.cfg.Micropub.LocationParam, gpxParameter},
withOnlyParameters: []string{a.cfg.Micropub.LocationParam, gpxParameter},
})
@ -57,7 +57,7 @@ func (a *goBlog) serveGeoMapTracks(w http.ResponseWriter, r *http.Request) {
allPostsWithTracks, err := a.getPosts(&postsRequestConfig{
blog: blog,
status: statusPublished,
statusse: a.getDefaultPostStatusse(r),
parameters: []string{gpxParameter},
withOnlyParameters: []string{gpxParameter},
excludeParameter: showRouteParam,
@ -103,7 +103,7 @@ func (a *goBlog) serveGeoMapLocations(w http.ResponseWriter, r *http.Request) {
allPostsWithLocations, err := a.getPosts(&postsRequestConfig{
blog: blog,
status: statusPublished,
statusse: a.getDefaultPostStatusse(r),
parameters: []string{a.cfg.Micropub.LocationParam},
withOnlyParameters: []string{a.cfg.Micropub.LocationParam},
})

@ -282,10 +282,7 @@ func (a *goBlog) serveIndex(w http.ResponseWriter, r *http.Request) {
statusse = []postStatus{ic.status}
}
if len(statusse) == 0 {
statusse = []postStatus{statusPublished}
if a.isLoggedIn(r) {
statusse = append(statusse, statusPrivate, statusUnlisted)
}
statusse = a.getDefaultPostStatusse(r)
}
p := paginator.New(&postPaginationAdapter{config: &postsRequestConfig{
blog: blog,

Loading…
Cancel
Save