Make ?view=external on profile page require a login if the profile is not actually public
This commit is contained in:
parent
99e9ef9c7b
commit
1dc9afca5a
|
@ -30,20 +30,6 @@ func Profile() http.HandlerFunc {
|
|||
return
|
||||
}
|
||||
|
||||
// Forcing an external view? (preview of logged-out profile view for visibility=external accounts)
|
||||
if r.FormValue("view") == "external" {
|
||||
vars := map[string]interface{}{
|
||||
"User": user,
|
||||
"IsPrivate": true,
|
||||
"IsExternalView": true,
|
||||
}
|
||||
if err := tmpl.Execute(w, r, vars); err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Get the current user (if logged in). If not, check for external view.
|
||||
currentUser, err := session.CurrentUser(r)
|
||||
if err != nil {
|
||||
|
@ -65,6 +51,21 @@ func Profile() http.HandlerFunc {
|
|||
return
|
||||
}
|
||||
|
||||
// Forcing an external view? (preview of logged-out profile view for visibility=external accounts)
|
||||
// You must be logged-in actually to see this.
|
||||
if r.FormValue("view") == "external" {
|
||||
vars := map[string]interface{}{
|
||||
"User": user,
|
||||
"IsPrivate": true,
|
||||
"IsExternalView": true,
|
||||
}
|
||||
if err := tmpl.Execute(w, r, vars); err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Inject relationship booleans for profile picture display.
|
||||
models.SetUserRelationships(currentUser, []*models.User{user})
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user