mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2026-07-25 02:48:05 +00:00
chore: modernize code (#12065)
Followup of !11115, it was not checked against the the modernizer linter. Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/12065 Reviewed-by: Otto <otto@codeberg.org> Co-authored-by: Gusted <postmaster@gusted.xyz> Co-committed-by: Gusted <postmaster@gusted.xyz>
This commit is contained in:
parent
e16dc2ebfd
commit
6a5dda7116
3 changed files with 4 additions and 13 deletions
|
|
@ -20,10 +20,7 @@ const (
|
||||||
|
|
||||||
func FederationHost(ctx *context.Context) {
|
func FederationHost(ctx *context.Context) {
|
||||||
federationHostID := ctx.ParamsInt64("id")
|
federationHostID := ctx.ParamsInt64("id")
|
||||||
page := ctx.FormInt("page")
|
page := max(ctx.FormInt("page"), 1)
|
||||||
if page < 1 {
|
|
||||||
page = 1
|
|
||||||
}
|
|
||||||
|
|
||||||
host, err := forgefed.GetFederationHost(ctx, federationHostID)
|
host, err := forgefed.GetFederationHost(ctx, federationHostID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -33,7 +30,7 @@ func FederationHost(ctx *context.Context) {
|
||||||
|
|
||||||
users, err := user_model.FindFederatedUsersByHostID(ctx, federationHostID, db.ListOptions{
|
users, err := user_model.FindFederatedUsersByHostID(ctx, federationHostID, db.ListOptions{
|
||||||
PageSize: setting.UI.Admin.FederationUserPagingNum,
|
PageSize: setting.UI.Admin.FederationUserPagingNum,
|
||||||
Page: int(page),
|
Page: page,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.ServerError("FindFederatedUsersByHostID", err)
|
ctx.ServerError("FindFederatedUsersByHostID", err)
|
||||||
|
|
|
||||||
|
|
@ -19,10 +19,7 @@ const (
|
||||||
|
|
||||||
func FederationHosts(ctx *context.Context) {
|
func FederationHosts(ctx *context.Context) {
|
||||||
sort := ctx.FormTrim("sort")
|
sort := ctx.FormTrim("sort")
|
||||||
page := ctx.FormInt("page")
|
page := max(ctx.FormInt("page"), 1)
|
||||||
if page < 1 {
|
|
||||||
page = 1
|
|
||||||
}
|
|
||||||
|
|
||||||
hosts, err := forgefed.FindFederationHosts(ctx, db.ListOptions{
|
hosts, err := forgefed.FindFederationHosts(ctx, db.ListOptions{
|
||||||
Page: page,
|
Page: page,
|
||||||
|
|
|
||||||
|
|
@ -18,10 +18,7 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
func FederationUsers(ctx *context.Context) {
|
func FederationUsers(ctx *context.Context) {
|
||||||
page := ctx.FormInt("page")
|
page := max(ctx.FormInt("page"), 1)
|
||||||
if page < 1 {
|
|
||||||
page = 1
|
|
||||||
}
|
|
||||||
|
|
||||||
users, err := user_model.FindFederatedUsers(ctx, db.ListOptions{
|
users, err := user_model.FindFederatedUsers(ctx, db.ListOptions{
|
||||||
Page: page,
|
Page: page,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue