Update calls and vars for Invites and elsewhere

Ref T661
This commit is contained in:
Matt Baer 2020-02-09 11:24:48 -05:00
parent 629d40b549
commit 7023b74d12
4 changed files with 11 additions and 11 deletions

View File

@ -656,7 +656,7 @@ func processCollectionPermissions(app *App, cr *collectionReq, u *User, w http.R
} }
// TODO: move this to all permission checks? // TODO: move this to all permission checks?
suspended, err := app.db.IsUserSuspended(c.OwnerID) suspended, err := app.db.IsUserSilenced(c.OwnerID)
if err != nil { if err != nil {
log.Error("process protected collection permissions: %v", err) log.Error("process protected collection permissions: %v", err)
return nil, err return nil, err

View File

@ -57,14 +57,14 @@ func handleViewUserInvites(app *App, u *User, w http.ResponseWriter, r *http.Req
p := struct { p := struct {
*UserPage *UserPage
Invites *[]Invite Invites *[]Invite
Suspended bool Silenced bool
}{ }{
UserPage: NewUserPage(app, r, u, "Invite People", f), UserPage: NewUserPage(app, r, u, "Invite People", f),
} }
var err error var err error
p.Suspended, err = app.db.IsUserSuspended(u.ID) p.Silenced, err = app.db.IsUserSilenced(u.ID)
if err != nil { if err != nil {
log.Error("view invites: %v", err) log.Error("view invites: %v", err)
} }

View File

@ -386,7 +386,7 @@ func handleViewPost(app *App, w http.ResponseWriter, r *http.Request) error {
var silenced bool var silenced bool
if found { if found {
silenced, err = app.db.IsUserSuspended(ownerID.Int64) silenced, err = app.db.IsUserSilenced(ownerID.Int64)
if err != nil { if err != nil {
log.Error("view post: %v", err) log.Error("view post: %v", err)
} }
@ -1365,7 +1365,7 @@ func viewCollectionPost(app *App, w http.ResponseWriter, r *http.Request) error
return ErrPostNotFound return ErrPostNotFound
} }
if c.IsProtected() && (u == nil || u.ID != c.OwnerID) { if c.IsProtected() && (u == nil || u.ID != c.OwnerID) {
if suspended { if silenced {
return ErrPostNotFound return ErrPostNotFound
} else if !isAuthorizedForCollection(app, c.Alias, r) { } else if !isAuthorizedForCollection(app, c.Alias, r) {
return impart.HTTPError{http.StatusFound, c.CanonicalURL() + "/?g=" + slug} return impart.HTTPError{http.StatusFound, c.CanonicalURL() + "/?g=" + slug}

View File

@ -20,8 +20,8 @@ table td {
</style> </style>
<div class="snug content-container"> <div class="snug content-container">
{{if .Suspended}} {{if .Silenced}}
{{template "user-suspended"}} {{template "user-silenced"}}
{{end}} {{end}}
<h1>Invite people</h1> <h1>Invite people</h1>
<p>Invite others to join <em>{{.SiteName}}</em> by generating and sharing invite links below.</p> <p>Invite others to join <em>{{.SiteName}}</em> by generating and sharing invite links below.</p>
@ -30,7 +30,7 @@ table td {
<div class="row"> <div class="row">
<div class="half"> <div class="half">
<label for="uses">Maximum number of uses:</label> <label for="uses">Maximum number of uses:</label>
<select id="uses" name="uses" {{if .Suspended}}disabled{{end}}> <select id="uses" name="uses" {{if .Silenced}}disabled{{end}}>
<option value="0">No limit</option> <option value="0">No limit</option>
<option value="1">1 use</option> <option value="1">1 use</option>
<option value="5">5 uses</option> <option value="5">5 uses</option>
@ -42,7 +42,7 @@ table td {
</div> </div>
<div class="half"> <div class="half">
<label for="expires">Expire after:</label> <label for="expires">Expire after:</label>
<select id="expires" name="expires" {{if .Suspended}}disabled{{end}}> <select id="expires" name="expires" {{if .Silenced}}disabled{{end}}>
<option value="0">Never</option> <option value="0">Never</option>
<option value="30">30 minutes</option> <option value="30">30 minutes</option>
<option value="60">1 hour</option> <option value="60">1 hour</option>
@ -55,7 +55,7 @@ table td {
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<input type="submit" value="Generate" {{if .Suspended}}disabled title="You cannot generate invites while your account is silenced."{{end}} /> <input type="submit" value="Generate" {{if .Silenced}}disabled title="You cannot generate invites while your account is silenced."{{end}} />
</div> </div>
</form> </form>