|
|
|
@ -746,7 +746,7 @@ func viewArticles(app *App, u *User, w http.ResponseWriter, r *http.Request) err |
|
|
|
|
log.Error("unable to fetch collections: %v", err) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
suspended, err := app.db.IsUserSuspended(u.ID) |
|
|
|
|
silenced, err := app.db.IsUserSilenced(u.ID) |
|
|
|
|
if err != nil { |
|
|
|
|
log.Error("view articles: %v", err) |
|
|
|
|
} |
|
|
|
@ -754,12 +754,12 @@ func viewArticles(app *App, u *User, w http.ResponseWriter, r *http.Request) err |
|
|
|
|
*UserPage |
|
|
|
|
AnonymousPosts *[]PublicPost |
|
|
|
|
Collections *[]Collection |
|
|
|
|
Suspended bool |
|
|
|
|
Silenced bool |
|
|
|
|
}{ |
|
|
|
|
UserPage: NewUserPage(app, r, u, u.Username+"'s Posts", f), |
|
|
|
|
AnonymousPosts: p, |
|
|
|
|
Collections: c, |
|
|
|
|
Suspended: suspended, |
|
|
|
|
Silenced: silenced, |
|
|
|
|
} |
|
|
|
|
d.UserPage.SetMessaging(u) |
|
|
|
|
w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate") |
|
|
|
@ -781,7 +781,7 @@ func viewCollections(app *App, u *User, w http.ResponseWriter, r *http.Request) |
|
|
|
|
uc, _ := app.db.GetUserCollectionCount(u.ID) |
|
|
|
|
// TODO: handle any errors
|
|
|
|
|
|
|
|
|
|
suspended, err := app.db.IsUserSuspended(u.ID) |
|
|
|
|
silenced, err := app.db.IsUserSilenced(u.ID) |
|
|
|
|
if err != nil { |
|
|
|
|
log.Error("view collections %v", err) |
|
|
|
|
return fmt.Errorf("view collections: %v", err) |
|
|
|
@ -793,13 +793,13 @@ func viewCollections(app *App, u *User, w http.ResponseWriter, r *http.Request) |
|
|
|
|
UsedCollections, TotalCollections int |
|
|
|
|
|
|
|
|
|
NewBlogsDisabled bool |
|
|
|
|
Suspended bool |
|
|
|
|
Silenced bool |
|
|
|
|
}{ |
|
|
|
|
UserPage: NewUserPage(app, r, u, u.Username+"'s Blogs", f), |
|
|
|
|
Collections: c, |
|
|
|
|
UsedCollections: int(uc), |
|
|
|
|
NewBlogsDisabled: !app.cfg.App.CanCreateBlogs(uc), |
|
|
|
|
Suspended: suspended, |
|
|
|
|
Silenced: silenced, |
|
|
|
|
} |
|
|
|
|
d.UserPage.SetMessaging(u) |
|
|
|
|
showUserPage(w, "collections", d) |
|
|
|
@ -817,7 +817,7 @@ func viewEditCollection(app *App, u *User, w http.ResponseWriter, r *http.Reques |
|
|
|
|
return ErrCollectionNotFound |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
suspended, err := app.db.IsUserSuspended(u.ID) |
|
|
|
|
silenced, err := app.db.IsUserSilenced(u.ID) |
|
|
|
|
if err != nil { |
|
|
|
|
log.Error("view edit collection %v", err) |
|
|
|
|
return fmt.Errorf("view edit collection: %v", err) |
|
|
|
@ -826,11 +826,11 @@ func viewEditCollection(app *App, u *User, w http.ResponseWriter, r *http.Reques |
|
|
|
|
obj := struct { |
|
|
|
|
*UserPage |
|
|
|
|
*Collection |
|
|
|
|
Suspended bool |
|
|
|
|
Silenced bool |
|
|
|
|
}{ |
|
|
|
|
UserPage: NewUserPage(app, r, u, "Edit "+c.DisplayTitle(), flashes), |
|
|
|
|
Collection: c, |
|
|
|
|
Suspended: suspended, |
|
|
|
|
Silenced: silenced, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
showUserPage(w, "collection", obj) |
|
|
|
@ -992,7 +992,7 @@ func viewStats(app *App, u *User, w http.ResponseWriter, r *http.Request) error |
|
|
|
|
titleStats = c.DisplayTitle() + " " |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
suspended, err := app.db.IsUserSuspended(u.ID) |
|
|
|
|
silenced, err := app.db.IsUserSilenced(u.ID) |
|
|
|
|
if err != nil { |
|
|
|
|
log.Error("view stats: %v", err) |
|
|
|
|
return err |
|
|
|
@ -1003,13 +1003,13 @@ func viewStats(app *App, u *User, w http.ResponseWriter, r *http.Request) error |
|
|
|
|
Collection *Collection |
|
|
|
|
TopPosts *[]PublicPost |
|
|
|
|
APFollowers int |
|
|
|
|
Suspended bool |
|
|
|
|
Silenced bool |
|
|
|
|
}{ |
|
|
|
|
UserPage: NewUserPage(app, r, u, titleStats+"Stats", flashes), |
|
|
|
|
VisitsBlog: alias, |
|
|
|
|
Collection: c, |
|
|
|
|
TopPosts: topPosts, |
|
|
|
|
Suspended: suspended, |
|
|
|
|
Silenced: silenced, |
|
|
|
|
} |
|
|
|
|
if app.cfg.App.Federation { |
|
|
|
|
folls, err := app.db.GetAPFollowers(c) |
|
|
|
@ -1043,13 +1043,13 @@ func viewSettings(app *App, u *User, w http.ResponseWriter, r *http.Request) err |
|
|
|
|
Email string |
|
|
|
|
HasPass bool |
|
|
|
|
IsLogOut bool |
|
|
|
|
Suspended bool |
|
|
|
|
Silenced bool |
|
|
|
|
}{ |
|
|
|
|
UserPage: NewUserPage(app, r, u, "Account Settings", flashes), |
|
|
|
|
Email: fullUser.EmailClear(app.keys), |
|
|
|
|
HasPass: passIsSet, |
|
|
|
|
IsLogOut: r.FormValue("logout") == "1", |
|
|
|
|
Suspended: fullUser.IsSilenced(), |
|
|
|
|
Silenced: fullUser.IsSilenced(), |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
showUserPage(w, "settings", obj) |
|
|
|
|