mirror of
https://github.com/writefreely/writefreely
synced 2024-11-28 03:20:17 +00:00
Change more suspension check logic
From u.Status == UserSuspended to u.IsSuspended() Ref T661
This commit is contained in:
parent
2c2ee0c00c
commit
f7550a0da8
5 changed files with 6 additions and 6 deletions
|
@ -1053,7 +1053,7 @@ func viewSettings(app *App, u *User, w http.ResponseWriter, r *http.Request) err
|
|||
Email: fullUser.EmailClear(app.keys),
|
||||
HasPass: passIsSet,
|
||||
IsLogOut: r.FormValue("logout") == "1",
|
||||
Suspended: fullUser.Status == UserSuspended,
|
||||
Suspended: fullUser.IsSuspended(),
|
||||
}
|
||||
|
||||
showUserPage(w, "settings", obj)
|
||||
|
|
2
admin.go
2
admin.go
|
@ -242,7 +242,7 @@ func handleAdminToggleUserStatus(app *App, u *User, w http.ResponseWriter, r *ht
|
|||
log.Error("failed to get user: %v", err)
|
||||
return impart.HTTPError{http.StatusInternalServerError, fmt.Sprintf("Could not get user from username: %v", err)}
|
||||
}
|
||||
if user.Status == UserSuspended {
|
||||
if user.IsSuspended() {
|
||||
err = app.db.SetUserStatus(user.ID, UserActive)
|
||||
} else {
|
||||
err = app.db.SetUserStatus(user.ID, UserSuspended)
|
||||
|
|
|
@ -906,10 +906,10 @@ func handleViewCollectionTag(app *App, w http.ResponseWriter, r *http.Request) e
|
|||
log.Error("Error getting user for collection: %v", err)
|
||||
}
|
||||
}
|
||||
if !isOwner && u.Status == UserSuspended {
|
||||
if !isOwner && u.IsSuspended() {
|
||||
return ErrCollectionNotFound
|
||||
}
|
||||
displayPage.Suspended = u.Status == UserSuspended
|
||||
displayPage.Suspended = u.IsSuspended()
|
||||
displayPage.Owner = owner
|
||||
coll.Owner = displayPage.Owner
|
||||
// Add more data
|
||||
|
|
|
@ -322,7 +322,7 @@ func (db *datastore) IsUserSuspended(id int64) (bool, error) {
|
|||
return false, fmt.Errorf("is user suspended: %v", err)
|
||||
}
|
||||
|
||||
return u.Status == UserSuspended, nil
|
||||
return u.IsSuspended(), nil
|
||||
}
|
||||
|
||||
// DoesUserNeedAuth returns true if the user hasn't provided any methods for
|
||||
|
|
|
@ -78,7 +78,7 @@ func handleCreateUserInvite(app *App, u *User, w http.ResponseWriter, r *http.Re
|
|||
muVal := r.FormValue("uses")
|
||||
expVal := r.FormValue("expires")
|
||||
|
||||
if u.Status == UserSuspended {
|
||||
if u.IsSuspended() {
|
||||
return ErrUserSuspended
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue