mirror of
https://github.com/writefreely/writefreely
synced 2024-11-28 03:20:17 +00:00
Rename UserSuspended to UserSilenced
Some of the work needed to have the backend match user-facing wording. Ref T661
This commit is contained in:
parent
c3f76a3ab8
commit
7f96e8c384
7 changed files with 11 additions and 11 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.IsSuspended(),
|
||||
Suspended: fullUser.IsSilenced(),
|
||||
}
|
||||
|
||||
showUserPage(w, "settings", obj)
|
||||
|
|
4
admin.go
4
admin.go
|
@ -242,10 +242,10 @@ 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.IsSuspended() {
|
||||
if user.IsSilenced() {
|
||||
err = app.db.SetUserStatus(user.ID, UserActive)
|
||||
} else {
|
||||
err = app.db.SetUserStatus(user.ID, UserSuspended)
|
||||
err = app.db.SetUserStatus(user.ID, UserSilenced)
|
||||
}
|
||||
if err != nil {
|
||||
log.Error("toggle user suspended: %v", err)
|
||||
|
|
|
@ -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.IsSuspended() {
|
||||
if !isOwner && u.IsSilenced() {
|
||||
return ErrCollectionNotFound
|
||||
}
|
||||
displayPage.Suspended = u.IsSuspended()
|
||||
displayPage.Suspended = u.IsSilenced()
|
||||
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.IsSuspended(), nil
|
||||
return u.IsSilenced(), 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.IsSuspended() {
|
||||
if u.IsSilenced() {
|
||||
return ErrUserSuspended
|
||||
}
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ td.active-suspend > input[type="submit"] {
|
|||
<a id="status"/>
|
||||
<th>Status</th>
|
||||
<td class="active-suspend">
|
||||
{{if .User.IsSuspended}}
|
||||
{{if .User.IsSilenced}}
|
||||
<p>Silenced</p>
|
||||
<input type="submit" value="Unsilence"/>
|
||||
{{else}}
|
||||
|
|
6
users.go
6
users.go
|
@ -23,7 +23,7 @@ type UserStatus int
|
|||
|
||||
const (
|
||||
UserActive = iota
|
||||
UserSuspended
|
||||
UserSilenced
|
||||
)
|
||||
|
||||
type (
|
||||
|
@ -127,6 +127,6 @@ func (u *User) IsAdmin() bool {
|
|||
return u.ID == 1
|
||||
}
|
||||
|
||||
func (u *User) IsSuspended() bool {
|
||||
return u.Status&UserSuspended != 0
|
||||
func (u *User) IsSilenced() bool {
|
||||
return u.Status&UserSilenced != 0
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue