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