mirror of
https://github.com/go-gitea/gitea.git
synced 2026-09-19 21:12:44 +02:00
chore: update golangci-lint to v2.13.0
Migrate the deprecated gofumpt `extra-rules` to `extra.group-params`, as the alias now also enables the new `clothe-returns` and `balance-calls` rules. Disable SA4023, which hangs on go 1.27, see https://github.com/golangci/golangci-lint/issues/6732. Apply the resulting modernize fixes, mostly flattening embedded struct literals and switching errors.As to errors.AsType. Assisted-by: Claude:Opus 5
This commit is contained in:
@@ -37,10 +37,8 @@ func Badges(ctx *context.Context) {
|
||||
ctx.Data["PageIsAdminBadges"] = true
|
||||
|
||||
RenderBadgeSearch(ctx, &user_model.SearchBadgeOptions{
|
||||
ListOptions: db.ListOptions{
|
||||
Page: max(ctx.FormInt("page"), 1),
|
||||
PageSize: setting.UI.Admin.UserPagingNum,
|
||||
},
|
||||
Page: max(ctx.FormInt("page"), 1),
|
||||
PageSize: setting.UI.Admin.UserPagingNum,
|
||||
}, tplBadges)
|
||||
}
|
||||
|
||||
@@ -106,10 +104,8 @@ func ViewBadge(ctx *context.Context) {
|
||||
}
|
||||
|
||||
opts := &user_model.GetBadgeUsersOptions{
|
||||
ListOptions: db.ListOptions{
|
||||
Page: 1,
|
||||
PageSize: setting.UI.Admin.UserPagingNum,
|
||||
},
|
||||
Page: 1,
|
||||
PageSize: setting.UI.Admin.UserPagingNum,
|
||||
BadgeSlug: badge.Slug,
|
||||
}
|
||||
users, count, err := user_model.GetBadgeUsers(ctx, opts)
|
||||
@@ -189,10 +185,8 @@ func BadgeUsers(ctx *context.Context) {
|
||||
|
||||
badge := &user_model.Badge{Slug: ctx.PathParam("badge_slug")}
|
||||
opts := &user_model.GetBadgeUsersOptions{
|
||||
ListOptions: db.ListOptions{
|
||||
Page: page,
|
||||
PageSize: setting.UI.Admin.UserPagingNum,
|
||||
},
|
||||
Page: page,
|
||||
PageSize: setting.UI.Admin.UserPagingNum,
|
||||
BadgeSlug: badge.Slug,
|
||||
}
|
||||
users, count, err := user_model.GetBadgeUsers(ctx, opts)
|
||||
|
||||
@@ -70,7 +70,7 @@ func MonitorDiagnosis(ctx *context.Context) {
|
||||
for _, record := range tailmsg.GetManager().GetTraceRecorder().GetRecords() {
|
||||
_, _ = f.Write(util.UnsafeStringToBytes(record.Time.Format(time.RFC3339)))
|
||||
_, _ = f.Write([]byte(" "))
|
||||
_, _ = f.Write(util.UnsafeStringToBytes((record.Content)))
|
||||
_, _ = f.Write(util.UnsafeStringToBytes(record.Content))
|
||||
_, _ = f.Write([]byte("\n\n"))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
||||
"gitea.dev/models/db"
|
||||
user_model "gitea.dev/models/user"
|
||||
"gitea.dev/modules/log"
|
||||
"gitea.dev/modules/optional"
|
||||
@@ -28,10 +27,8 @@ func Emails(ctx *context.Context) {
|
||||
ctx.Data["PageIsAdminEmails"] = true
|
||||
|
||||
opts := &user_model.SearchEmailOptions{
|
||||
ListOptions: db.ListOptions{
|
||||
PageSize: setting.UI.Admin.UserPagingNum,
|
||||
Page: ctx.FormInt("page"),
|
||||
},
|
||||
PageSize: setting.UI.Admin.UserPagingNum,
|
||||
Page: ctx.FormInt("page"),
|
||||
}
|
||||
|
||||
if opts.Page <= 1 {
|
||||
|
||||
@@ -28,10 +28,8 @@ func Organizations(ctx *context.Context) {
|
||||
Actor: ctx.Doer,
|
||||
Types: []user_model.UserType{user_model.UserTypeOrganization},
|
||||
IncludeReserved: true, // administrator needs to list all accounts include reserved
|
||||
ListOptions: db.ListOptions{
|
||||
PageSize: setting.UI.Admin.OrgPagingNum,
|
||||
},
|
||||
Visible: []structs.VisibleType{structs.VisibleTypePublic, structs.VisibleTypeLimited, structs.VisibleTypePrivate},
|
||||
OrderBy: db.SearchOrderBy(sortOrder),
|
||||
PageSize: setting.UI.Admin.OrgPagingNum,
|
||||
Visible: []structs.VisibleType{structs.VisibleTypePublic, structs.VisibleTypeLimited, structs.VisibleTypePrivate},
|
||||
OrderBy: db.SearchOrderBy(sortOrder),
|
||||
}, tplOrgs)
|
||||
}
|
||||
|
||||
@@ -63,11 +63,9 @@ func Users(ctx *context.Context) {
|
||||
}
|
||||
|
||||
explore.RenderUserSearch(ctx, user_model.SearchUserOptions{
|
||||
Actor: ctx.Doer,
|
||||
Types: []user_model.UserType{user_model.UserTypeIndividual},
|
||||
ListOptions: db.ListOptions{
|
||||
PageSize: setting.UI.Admin.UserPagingNum,
|
||||
},
|
||||
Actor: ctx.Doer,
|
||||
Types: []user_model.UserType{user_model.UserTypeIndividual},
|
||||
PageSize: setting.UI.Admin.UserPagingNum,
|
||||
SearchByEmail: true,
|
||||
IsActive: optional.ParseBool(statusFilterMap["is_active"]),
|
||||
IsAdmin: optional.ParseBool(statusFilterMap["is_admin"]),
|
||||
|
||||
@@ -58,7 +58,7 @@ func prepareMockDataGiteaUI(_ *context.Context) {}
|
||||
|
||||
func prepareMockDataBadgeCommitSign(ctx *context.Context) {
|
||||
var commits []*asymkey.SignCommit
|
||||
mockUsers, _ := db.Find[user_model.User](ctx, user_model.SearchUserOptions{ListOptions: db.ListOptions{PageSize: 1}})
|
||||
mockUsers, _ := db.Find[user_model.User](ctx, user_model.SearchUserOptions{PageSize: 1})
|
||||
mockUser := mockUsers[0]
|
||||
commits = append(commits, &asymkey.SignCommit{
|
||||
Verification: &asymkey.CommitVerification{},
|
||||
|
||||
@@ -41,11 +41,11 @@ func Organizations(ctx *context.Context) {
|
||||
sortOrderDefault := util.Iif(supportedSortOrders.Contains(setting.UI.ExploreDefaultSort), setting.UI.ExploreDefaultSort, "newest")
|
||||
sortOrder := ctx.FormString("sort", sortOrderDefault)
|
||||
RenderUserSearch(ctx, user_model.SearchUserOptions{
|
||||
Actor: ctx.Doer,
|
||||
Types: []user_model.UserType{user_model.UserTypeOrganization},
|
||||
ListOptions: db.ListOptions{PageSize: setting.UI.ExplorePagingNum},
|
||||
Visible: visibleTypes,
|
||||
OrderBy: db.SearchOrderBy(sortOrder),
|
||||
Actor: ctx.Doer,
|
||||
Types: []user_model.UserType{user_model.UserTypeOrganization},
|
||||
PageSize: setting.UI.ExplorePagingNum,
|
||||
Visible: visibleTypes,
|
||||
OrderBy: db.SearchOrderBy(sortOrder),
|
||||
|
||||
SupportedSortOrders: supportedSortOrders,
|
||||
}, tplExploreUsers)
|
||||
|
||||
@@ -95,10 +95,8 @@ func RenderRepoSearch(ctx *context.Context, opts *RepoSearchOptions) {
|
||||
ctx.Data["IsPrivate"] = private
|
||||
|
||||
repos, count, err = repo_model.SearchRepository(ctx, repo_model.SearchRepoOptions{
|
||||
ListOptions: db.ListOptions{
|
||||
Page: page,
|
||||
PageSize: opts.PageSize,
|
||||
},
|
||||
Page: page,
|
||||
PageSize: opts.PageSize,
|
||||
Actor: ctx.Doer,
|
||||
OrderBy: orderBy,
|
||||
Private: opts.Private,
|
||||
|
||||
@@ -16,11 +16,9 @@ import (
|
||||
// TopicSearch search for creating topic
|
||||
func TopicSearch(ctx *context.Context) {
|
||||
opts := &repo_model.FindTopicOptions{
|
||||
Keyword: ctx.FormString("q"),
|
||||
ListOptions: db.ListOptions{
|
||||
Page: ctx.FormInt("page"),
|
||||
PageSize: convert.ToCorrectPageSize(ctx.FormInt("limit")),
|
||||
},
|
||||
Keyword: ctx.FormString("q"),
|
||||
Page: ctx.FormInt("page"),
|
||||
PageSize: convert.ToCorrectPageSize(ctx.FormInt("limit")),
|
||||
}
|
||||
|
||||
topics, total, err := db.FindAndCount[repo_model.Topic](ctx, opts)
|
||||
|
||||
@@ -144,12 +144,12 @@ func Users(ctx *context.Context) {
|
||||
sortOrderDefault := util.Iif(supportedSortOrders.Contains(setting.UI.ExploreDefaultSort), setting.UI.ExploreDefaultSort, "newest")
|
||||
sortOrder := ctx.FormString("sort", sortOrderDefault)
|
||||
RenderUserSearch(ctx, user_model.SearchUserOptions{
|
||||
Actor: ctx.Doer,
|
||||
Types: []user_model.UserType{user_model.UserTypeIndividual},
|
||||
ListOptions: db.ListOptions{PageSize: setting.UI.ExplorePagingNum},
|
||||
IsActive: optional.Some(true),
|
||||
Visible: []structs.VisibleType{structs.VisibleTypePublic, structs.VisibleTypeLimited, structs.VisibleTypePrivate},
|
||||
OrderBy: db.SearchOrderBy(sortOrder),
|
||||
Actor: ctx.Doer,
|
||||
Types: []user_model.UserType{user_model.UserTypeIndividual},
|
||||
PageSize: setting.UI.ExplorePagingNum,
|
||||
IsActive: optional.Some(true),
|
||||
Visible: []structs.VisibleType{structs.VisibleTypePublic, structs.VisibleTypeLimited, structs.VisibleTypePrivate},
|
||||
OrderBy: db.SearchOrderBy(sortOrder),
|
||||
|
||||
SupportedSortOrders: supportedSortOrders,
|
||||
}, tplExploreUsers)
|
||||
|
||||
+5
-8
@@ -8,7 +8,6 @@ import (
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"gitea.dev/models/db"
|
||||
repo_model "gitea.dev/models/repo"
|
||||
user_model "gitea.dev/models/user"
|
||||
"gitea.dev/modules/log"
|
||||
@@ -69,10 +68,10 @@ func HomeSitemap(ctx *context.Context) {
|
||||
m := sitemap.NewSitemapIndex()
|
||||
if !setting.Service.Explore.DisableUsersPage {
|
||||
_, cnt, err := user_model.SearchUsers(ctx, user_model.SearchUserOptions{
|
||||
Types: []user_model.UserType{user_model.UserTypeIndividual},
|
||||
ListOptions: db.ListOptions{PageSize: 1},
|
||||
IsActive: optional.Some(true),
|
||||
Visible: []structs.VisibleType{structs.VisibleTypePublic},
|
||||
Types: []user_model.UserType{user_model.UserTypeIndividual},
|
||||
PageSize: 1,
|
||||
IsActive: optional.Some(true),
|
||||
Visible: []structs.VisibleType{structs.VisibleTypePublic},
|
||||
})
|
||||
if err != nil {
|
||||
ctx.ServerError("SearchUsers", err)
|
||||
@@ -87,9 +86,7 @@ func HomeSitemap(ctx *context.Context) {
|
||||
}
|
||||
|
||||
_, cnt, err := repo_model.SearchRepository(ctx, repo_model.SearchRepoOptions{
|
||||
ListOptions: db.ListOptions{
|
||||
PageSize: 1,
|
||||
},
|
||||
PageSize: 1,
|
||||
Actor: ctx.Doer,
|
||||
AllPublic: true,
|
||||
})
|
||||
|
||||
@@ -89,7 +89,7 @@ func home(ctx *context.Context, viewRepositories bool) {
|
||||
Doer: ctx.Doer,
|
||||
OrgID: org.ID,
|
||||
IsDoerMember: ctx.Org.IsMember,
|
||||
ListOptions: db.ListOptions{Page: 1, PageSize: 25},
|
||||
Page: 1, PageSize: 25,
|
||||
}
|
||||
|
||||
members, _, err := organization.FindOrgMembers(ctx, opts)
|
||||
@@ -109,9 +109,9 @@ func home(ctx *context.Context, viewRepositories bool) {
|
||||
overviewTeams = nil
|
||||
if ctx.Org.IsMember {
|
||||
overviewTeams, _, err = organization.SearchTeam(ctx, &organization.SearchTeamOptions{
|
||||
OrgID: org.ID,
|
||||
UserID: ctx.Doer.ID,
|
||||
ListOptions: db.ListOptions{Page: 1, PageSize: orgOverviewTeamsLimit},
|
||||
OrgID: org.ID,
|
||||
UserID: ctx.Doer.ID,
|
||||
Page: 1, PageSize: orgOverviewTeamsLimit,
|
||||
})
|
||||
if err != nil {
|
||||
ctx.ServerError("SearchTeam", err)
|
||||
@@ -136,10 +136,8 @@ func home(ctx *context.Context, viewRepositories bool) {
|
||||
ctx.Data["ShowOrgProfileReadmeSelector"] = isViewOverview && prepareResult.ProfilePublicReadmeBlob != nil && prepareResult.ProfilePrivateReadmeBlob != nil
|
||||
|
||||
repos, count, err := repo_model.SearchRepository(ctx, repo_model.SearchRepoOptions{
|
||||
ListOptions: db.ListOptions{
|
||||
PageSize: setting.UI.User.RepoPagingNum,
|
||||
Page: page,
|
||||
},
|
||||
PageSize: setting.UI.User.RepoPagingNum,
|
||||
Page: page,
|
||||
Keyword: keyword,
|
||||
OwnerID: org.ID,
|
||||
OrderBy: orderBy,
|
||||
|
||||
@@ -53,10 +53,8 @@ func Projects(ctx *context.Context) {
|
||||
projectType = project_model.TypeIndividual
|
||||
}
|
||||
projects, total, err := db.FindAndCount[project_model.Project](ctx, project_model.SearchOptions{
|
||||
ListOptions: db.ListOptions{
|
||||
Page: page,
|
||||
PageSize: setting.UI.IssuePagingNum,
|
||||
},
|
||||
Page: page,
|
||||
PageSize: setting.UI.IssuePagingNum,
|
||||
OwnerID: ctx.ContextUser.ID,
|
||||
IsClosed: optional.Some(isShowClosed),
|
||||
OrderBy: project_model.GetSearchOrderByBySortType(sortType),
|
||||
|
||||
@@ -83,7 +83,7 @@ func Teams(ctx *context.Context) {
|
||||
IncludeDesc: true,
|
||||
IncludeVisibilities: util.Iif(shouldSeeAllOrgTeams, nil,
|
||||
org_model.VisibleTeamVisibilitiesFor(ctx.Org.IsMember, ctx.IsSigned)),
|
||||
ListOptions: db.ListOptions{Page: page, PageSize: pagingNum},
|
||||
Page: page, PageSize: pagingNum,
|
||||
}
|
||||
return org_model.SearchTeam(ctx, opts)
|
||||
}
|
||||
|
||||
@@ -451,9 +451,7 @@ func prepareWorkflowDispatchTemplate(ctx *context.Context, workflowInfos []Workf
|
||||
branchOpts := git_model.FindBranchOptions{
|
||||
RepoID: ctx.Repo.Repository.ID,
|
||||
IsDeletedBranch: optional.Some(false),
|
||||
ListOptions: db.ListOptions{
|
||||
ListAll: true,
|
||||
},
|
||||
ListAll: true,
|
||||
}
|
||||
branches, err := git_model.FindBranchNames(ctx, branchOpts)
|
||||
if err != nil {
|
||||
@@ -475,10 +473,8 @@ func prepareWorkflowDispatchTemplate(ctx *context.Context, workflowInfos []Workf
|
||||
|
||||
func (data *actionRunListData) prepareFullPageRuns(ctx *context.Context, otherWorkflows []string) bool {
|
||||
opts := actions_model.FindRunOptions{
|
||||
ListOptions: db.ListOptions{
|
||||
Page: max(ctx.FormInt("page"), 1),
|
||||
PageSize: convert.ToCorrectPageSize(ctx.FormInt("limit")),
|
||||
},
|
||||
Page: max(ctx.FormInt("page"), 1),
|
||||
PageSize: convert.ToCorrectPageSize(ctx.FormInt("limit")),
|
||||
RepoID: ctx.Repo.Repository.ID,
|
||||
WorkflowID: data.workflowID,
|
||||
WorkflowRepoID: data.scopedWorkflowSourceRepoID,
|
||||
|
||||
@@ -54,7 +54,7 @@ func TestNewPullRequestTitleContent(t *testing.T) {
|
||||
SignCommit: &asymkey_model.SignCommit{
|
||||
UserCommit: &gituser.UserCommit{
|
||||
GitCommit: &git.Commit{
|
||||
CommitMessage: git.CommitMessage{MessageRaw: msg},
|
||||
MessageRaw: msg,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -41,10 +41,8 @@ func Milestones(ctx *context.Context) {
|
||||
page := max(ctx.FormInt("page"), 1)
|
||||
|
||||
miles, total, err := db.FindAndCount[issues_model.Milestone](ctx, issues_model.FindMilestoneOptions{
|
||||
ListOptions: db.ListOptions{
|
||||
Page: page,
|
||||
PageSize: setting.UI.IssuePagingNum,
|
||||
},
|
||||
Page: page,
|
||||
PageSize: setting.UI.IssuePagingNum,
|
||||
RepoID: ctx.Repo.Repository.ID,
|
||||
IsClosed: optional.Some(isShowClosed),
|
||||
SortType: sortType,
|
||||
|
||||
@@ -66,10 +66,8 @@ func Projects(ctx *context.Context) {
|
||||
ctx.Data["ClosedCount"] = repo.NumClosedProjects
|
||||
|
||||
projects, count, err := db.FindAndCount[project_model.Project](ctx, project_model.SearchOptions{
|
||||
ListOptions: db.ListOptions{
|
||||
PageSize: setting.UI.IssuePagingNum,
|
||||
Page: page,
|
||||
},
|
||||
PageSize: setting.UI.IssuePagingNum,
|
||||
Page: page,
|
||||
RepoID: repo.ID,
|
||||
IsClosed: optional.Some(isShowClosed),
|
||||
OrderBy: project_model.GetSearchOrderByBySortType(sortType),
|
||||
|
||||
@@ -281,9 +281,9 @@ func SingleRelease(ctx *context.Context) {
|
||||
ctx.Data["CanCreateRelease"] = writeAccess && !ctx.Repo.Repository.IsArchived
|
||||
|
||||
releases, err := getReleaseInfos(ctx, &repo_model.FindReleasesOptions{
|
||||
ListOptions: db.ListOptions{Page: 1, PageSize: 1},
|
||||
RepoID: ctx.Repo.Repository.ID,
|
||||
TagNames: []string{ctx.PathParam("*")},
|
||||
Page: 1, PageSize: 1,
|
||||
RepoID: ctx.Repo.Repository.ID,
|
||||
TagNames: []string{ctx.PathParam("*")},
|
||||
// only show draft releases for users who can write, read-only users shouldn't see draft releases.
|
||||
IncludeDrafts: writeAccess,
|
||||
IncludeTags: true,
|
||||
|
||||
@@ -429,10 +429,8 @@ func SearchRepo(ctx *context.Context) {
|
||||
page = 1
|
||||
}
|
||||
opts := repo_model.SearchRepoOptions{
|
||||
ListOptions: db.ListOptions{
|
||||
Page: page,
|
||||
PageSize: convert.ToCorrectPageSize(ctx.FormInt("limit")),
|
||||
},
|
||||
Page: page,
|
||||
PageSize: convert.ToCorrectPageSize(ctx.FormInt("limit")),
|
||||
Actor: ctx.Doer,
|
||||
Keyword: ctx.FormTrim("q"),
|
||||
OwnerID: ctx.FormInt64("uid"),
|
||||
|
||||
@@ -668,10 +668,10 @@ func TestWebhook(ctx *context.Context) {
|
||||
ghostUser := user_model.NewGhostUser()
|
||||
objectFormat := git.ObjectFormatFromName(ctx.Repo.Repository.ObjectFormatName)
|
||||
commit := &git.Commit{
|
||||
ID: objectFormat.EmptyObjectID(),
|
||||
Author: ghostUser.NewGitSig(),
|
||||
Committer: ghostUser.NewGitSig(),
|
||||
CommitMessage: git.CommitMessage{MessageRaw: "This is a fake commit for webhook push test"},
|
||||
ID: objectFormat.EmptyObjectID(),
|
||||
Author: ghostUser.NewGitSig(),
|
||||
Committer: ghostUser.NewGitSig(),
|
||||
MessageRaw: "This is a fake commit for webhook push test",
|
||||
}
|
||||
|
||||
apiUser := convert.ToUserWithAccessMode(ctx, ctx.Doer, perm.AccessModeNone)
|
||||
|
||||
@@ -112,12 +112,10 @@ func Runners(ctx *context.Context) {
|
||||
page := max(ctx.FormInt("page"), 1)
|
||||
|
||||
opts := actions_model.FindRunnerOptions{
|
||||
ListOptions: db.ListOptions{
|
||||
Page: page,
|
||||
PageSize: 100,
|
||||
},
|
||||
Sort: ctx.Req.URL.Query().Get("sort"),
|
||||
Filter: ctx.Req.URL.Query().Get("q"),
|
||||
Page: page,
|
||||
PageSize: 100,
|
||||
Sort: ctx.Req.URL.Query().Get("sort"),
|
||||
Filter: ctx.Req.URL.Query().Get("q"),
|
||||
}
|
||||
if rCtx.IsRepo {
|
||||
opts.RepoID = rCtx.RepoID
|
||||
@@ -202,10 +200,8 @@ func RunnersEdit(ctx *context.Context) {
|
||||
ctx.Data["Runner"] = runner
|
||||
|
||||
opts := actions_model.FindTaskOptions{
|
||||
ListOptions: db.ListOptions{
|
||||
Page: page,
|
||||
PageSize: 30,
|
||||
},
|
||||
Page: page,
|
||||
PageSize: 30,
|
||||
Status: actions_model.StatusUnknown, // Unknown means all
|
||||
RunnerID: runner.ID,
|
||||
}
|
||||
|
||||
@@ -50,11 +50,9 @@ func prepareContextForProfileBigAvatar(ctx *context.Context) {
|
||||
orgs, err := db.Find[organization.Organization](ctx, organization.FindOrgOptions{
|
||||
UserID: ctx.ContextUser.ID,
|
||||
IncludeVisibility: organization.DoerViewOtherVisibility(ctx.Doer, ctx.ContextUser),
|
||||
ListOptions: db.ListOptions{
|
||||
Page: 1,
|
||||
// query one more result (without a separate counting) to see whether we need to add the "show more orgs" link
|
||||
PageSize: setting.UI.User.OrgPagingNum + 1,
|
||||
},
|
||||
Page: 1,
|
||||
// query one more result (without a separate counting) to see whether we need to add the "show more orgs" link
|
||||
PageSize: setting.UI.User.OrgPagingNum + 1,
|
||||
})
|
||||
if err != nil {
|
||||
ctx.ServerError("FindOrgs", err)
|
||||
|
||||
@@ -120,7 +120,7 @@ func Dashboard(ctx *context.Context) {
|
||||
OnlyPerformedBy: false,
|
||||
IncludeDeleted: false,
|
||||
Date: ctx.FormString("date"),
|
||||
ListOptions: db.ListOptions{Page: page, PageSize: pageSize},
|
||||
Page: page, PageSize: pageSize,
|
||||
})
|
||||
if err != nil {
|
||||
ctx.ServerError("GetFeeds", err)
|
||||
@@ -221,10 +221,8 @@ func Milestones(ctx *context.Context) {
|
||||
}
|
||||
|
||||
milestones, err := db.Find[issues_model.Milestone](ctx, issues_model.FindMilestoneOptions{
|
||||
ListOptions: db.ListOptions{
|
||||
Page: page,
|
||||
PageSize: setting.UI.IssuePagingNum,
|
||||
},
|
||||
Page: page,
|
||||
PageSize: setting.UI.IssuePagingNum,
|
||||
RepoCond: repoCond,
|
||||
IsClosed: optional.Some(isShowClosed),
|
||||
SortType: sortType,
|
||||
|
||||
@@ -74,12 +74,10 @@ func prepareUserNotificationsData(ctx *context.Context) {
|
||||
|
||||
statuses := []activities_model.NotificationStatus{queryStatus, activities_model.NotificationStatusPinned}
|
||||
nls, err := db.Find[activities_model.Notification](ctx, activities_model.FindNotificationOptions{
|
||||
ListOptions: db.ListOptions{
|
||||
PageSize: perPage,
|
||||
Page: page,
|
||||
},
|
||||
UserID: ctx.Doer.ID,
|
||||
Status: statuses,
|
||||
PageSize: perPage,
|
||||
Page: page,
|
||||
UserID: ctx.Doer.ID,
|
||||
Status: statuses,
|
||||
})
|
||||
if err != nil {
|
||||
ctx.ServerError("db.Find[activities_model.Notification]", err)
|
||||
@@ -374,10 +372,8 @@ func NotificationWatching(ctx *context.Context) {
|
||||
ctx.Data["IsPrivate"] = private
|
||||
|
||||
repos, count, err := repo_model.SearchRepository(ctx, repo_model.SearchRepoOptions{
|
||||
ListOptions: db.ListOptions{
|
||||
PageSize: setting.UI.User.RepoPagingNum,
|
||||
Page: page,
|
||||
},
|
||||
PageSize: setting.UI.User.RepoPagingNum,
|
||||
Page: page,
|
||||
Actor: ctx.Doer,
|
||||
Keyword: keyword,
|
||||
OrderBy: orderBy,
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
"time"
|
||||
"uuid"
|
||||
|
||||
"gitea.dev/models/db"
|
||||
org_model "gitea.dev/models/organization"
|
||||
@@ -35,8 +36,6 @@ import (
|
||||
"gitea.dev/services/forms"
|
||||
packages_service "gitea.dev/services/packages"
|
||||
container_service "gitea.dev/services/packages/container"
|
||||
|
||||
"uuid"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
+10
-20
@@ -179,10 +179,8 @@ func prepareUserProfileTabData(ctx *context.Context, profileDbRepo *repo_model.R
|
||||
OnlyPerformedBy: true,
|
||||
IncludeDeleted: false,
|
||||
Date: date,
|
||||
ListOptions: db.ListOptions{
|
||||
PageSize: pagingNum,
|
||||
Page: page,
|
||||
},
|
||||
PageSize: pagingNum,
|
||||
Page: page,
|
||||
})
|
||||
if err != nil {
|
||||
ctx.ServerError("GetFeeds", err)
|
||||
@@ -196,10 +194,8 @@ func prepareUserProfileTabData(ctx *context.Context, profileDbRepo *repo_model.R
|
||||
ctx.Data["PageIsProfileStarList"] = true
|
||||
ctx.Data["ShowRepoOwnerOnList"] = true
|
||||
repos, count, err = repo_model.SearchRepository(ctx, repo_model.SearchRepoOptions{
|
||||
ListOptions: db.ListOptions{
|
||||
PageSize: pagingNum,
|
||||
Page: page,
|
||||
},
|
||||
PageSize: pagingNum,
|
||||
Page: page,
|
||||
Actor: ctx.Doer,
|
||||
Keyword: keyword,
|
||||
OrderBy: orderBy,
|
||||
@@ -223,10 +219,8 @@ func prepareUserProfileTabData(ctx *context.Context, profileDbRepo *repo_model.R
|
||||
total = count
|
||||
case "watching":
|
||||
repos, count, err = repo_model.SearchRepository(ctx, repo_model.SearchRepoOptions{
|
||||
ListOptions: db.ListOptions{
|
||||
PageSize: pagingNum,
|
||||
Page: page,
|
||||
},
|
||||
PageSize: pagingNum,
|
||||
Page: page,
|
||||
Actor: ctx.Doer,
|
||||
Keyword: keyword,
|
||||
OrderBy: orderBy,
|
||||
@@ -265,10 +259,8 @@ func prepareUserProfileTabData(ctx *context.Context, profileDbRepo *repo_model.R
|
||||
orgs, count, err := db.FindAndCount[organization.Organization](ctx, organization.FindOrgOptions{
|
||||
UserID: ctx.ContextUser.ID,
|
||||
IncludeVisibility: organization.DoerViewOtherVisibility(ctx.Doer, ctx.ContextUser),
|
||||
ListOptions: db.ListOptions{
|
||||
Page: page,
|
||||
PageSize: pagingNum,
|
||||
},
|
||||
Page: page,
|
||||
PageSize: pagingNum,
|
||||
})
|
||||
if err != nil {
|
||||
ctx.ServerError("GetUserOrganizations", err)
|
||||
@@ -278,10 +270,8 @@ func prepareUserProfileTabData(ctx *context.Context, profileDbRepo *repo_model.R
|
||||
total = count
|
||||
default: // default to "repositories"
|
||||
repos, count, err = repo_model.SearchRepository(ctx, repo_model.SearchRepoOptions{
|
||||
ListOptions: db.ListOptions{
|
||||
PageSize: pagingNum,
|
||||
Page: page,
|
||||
},
|
||||
PageSize: pagingNum,
|
||||
Page: page,
|
||||
Actor: ctx.Doer,
|
||||
Keyword: keyword,
|
||||
OwnerID: ctx.ContextUser.ID,
|
||||
|
||||
@@ -6,7 +6,6 @@ package user
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"gitea.dev/models/db"
|
||||
user_model "gitea.dev/models/user"
|
||||
"gitea.dev/modules/optional"
|
||||
"gitea.dev/modules/setting"
|
||||
@@ -21,11 +20,11 @@ func SearchCandidates(ctx *context.Context) {
|
||||
searchUserTypes = append(searchUserTypes, user_model.UserTypeOrganization)
|
||||
}
|
||||
users, _, err := user_model.SearchUsers(ctx, user_model.SearchUserOptions{
|
||||
Actor: ctx.Doer,
|
||||
Keyword: ctx.FormTrim("q"),
|
||||
Types: searchUserTypes,
|
||||
IsActive: optional.Some(true),
|
||||
ListOptions: db.ListOptions{PageSize: setting.UI.MembersPagingNum},
|
||||
Actor: ctx.Doer,
|
||||
Keyword: ctx.FormTrim("q"),
|
||||
Types: searchUserTypes,
|
||||
IsActive: optional.Some(true),
|
||||
PageSize: setting.UI.MembersPagingNum,
|
||||
})
|
||||
if err != nil {
|
||||
ctx.ServerError("Unable to search users", err)
|
||||
|
||||
@@ -195,10 +195,8 @@ func Organization(ctx *context.Context) {
|
||||
ctx.Data["PageIsSettingsOrganization"] = true
|
||||
|
||||
opts := organization.FindOrgOptions{
|
||||
ListOptions: db.ListOptions{
|
||||
PageSize: setting.UI.Admin.UserPagingNum,
|
||||
Page: ctx.FormInt("page"),
|
||||
},
|
||||
PageSize: setting.UI.Admin.UserPagingNum,
|
||||
Page: ctx.FormInt("page"),
|
||||
UserID: ctx.Doer.ID,
|
||||
IncludeVisibility: structs.VisibleTypePrivate,
|
||||
}
|
||||
@@ -277,12 +275,10 @@ func Repos(ctx *context.Context) {
|
||||
}
|
||||
|
||||
userRepos, _, err := repo_model.GetUserRepositories(ctx, repo_model.SearchRepoOptions{
|
||||
Actor: ctxUser,
|
||||
Private: true,
|
||||
ListOptions: db.ListOptions{
|
||||
Page: 1,
|
||||
PageSize: setting.UI.Admin.UserPagingNum,
|
||||
},
|
||||
Actor: ctxUser,
|
||||
Private: true,
|
||||
Page: 1,
|
||||
PageSize: setting.UI.Admin.UserPagingNum,
|
||||
LowerNames: repoNames,
|
||||
})
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user