Remove extra OwnUserPage field

Move logic into template, rather than add another field to the page.

Ref T695
pull/192/head
Matt Baer 5 years ago
parent 6e09fcb9e2
commit 6d4ec0b17d
  1. 6
      admin.go
  2. 2
      templates/user/admin/view-user.tmpl

@ -169,9 +169,8 @@ func handleViewAdminUser(app *App, u *User, w http.ResponseWriter, r *http.Reque
p := struct {
*UserPage
Config config.AppCfg
Message string
OwnUserPage bool
Config config.AppCfg
Message string
User *User
Colls []inspectedCollection
@ -196,7 +195,6 @@ func handleViewAdminUser(app *App, u *User, w http.ResponseWriter, r *http.Reque
if err != nil {
return impart.HTTPError{http.StatusInternalServerError, fmt.Sprintf("Could not get user: %v", err)}
}
p.OwnUserPage = u.ID == p.User.ID
p.UserPage = NewUserPage(app, r, u, p.User.Username, nil)
p.TotalPosts = app.db.GetUserPostsCount(p.User.ID)
lp, err := app.db.GetUserLastPostTime(p.User.ID)

@ -61,7 +61,7 @@ button[type="submit"].danger {
<tr>
<th>Password</th>
<td>
{{if not .OwnUserPage}}
{{if ne .Username .User.Username}}
<form id="reset-form" action="/admin/user/{{.User.Username}}/passphrase" method="post" autocomplete="false">
<input type="hidden" name="user" value="{{.User.ID}}"/>
<button

Loading…
Cancel
Save