[API] generalize list header #16551
Labels
No Label
backport/done
backport/v1.0
backport/v1.1
backport/v1.10
backport/v1.11
backport/v1.12
backport/v1.13
backport/v1.14
backport/v1.15
backport/v1.2
backport/v1.3
backport/v1.4
backport/v1.5
backport/v1.6
backport/v1.7
backport/v1.8
backport/v1.9
bounty
changelog
dependencies
frontport/done
frontport/main
good first issue
Hacktoberfest
hacktoberfest-accepted
in progress
kind/api
kind/breaking
kind/bug
kind/build
kind/deployment
kind/deprecated
kind/docs
kind/enhancement
kind/feature
kind/lint
kind/misc
kind/moderation
kind/package
kind/proposal
kind/question
kind/refactor
kind/regression
kind/security
kind/summary
kind/testing
kind/translation
kind/ui
kind/upstream-related
kind/usability
kind/ux
lgtm/done
lgtm/need 1
lgtm/need 2
performance/bigrepo
performance/cpu
performance/memory
performance/speed
priority/critical
priority/low
priority/maybe
priority/medium
proposal/rejected
reviewed/confirmed
reviewed/duplicate
reviewed/fixed
reviewed/invalid
reviewed/not-a-bug
reviewed/wontfix
skip-changelog
stale
status/blocked
status/needs-feedback
status/wip
theme/2fa
theme/authentication
theme/avatar
theme/backup-restore
theme/docker
theme/federation
theme/issues
theme/kanban
theme/markdown
theme/migration
theme/mobile
theme/pr
theme/signing
theme/sqlite
theme/timetracker
theme/webhook
theme/wiki
No Milestone
No project
No Assignees
2 Participants
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: lunny/gitea#16551
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "api-generalize-list-header"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
close #11114
@ -89,2 +91,3 @@
count, err := models.CountDeployKeys(opts)
if err != nil {
ctx.Error(http.StatusInternalServerError, "ListDeployKeys", err)
ctx.InternalServerError(err)
So there is a Xorm function called FindAndCount which doesn't pass the limits which may be better.
@ -89,2 +91,3 @@
count, err := models.CountDeployKeys(opts)
if err != nil {
ctx.Error(http.StatusInternalServerError, "ListDeployKeys", err)
ctx.InternalServerError(err)
oh was not aware of it ... will need to refactor a lot then
@ -89,2 +91,3 @@
count, err := models.CountDeployKeys(opts)
if err != nil {
ctx.Error(http.StatusInternalServerError, "ListDeployKeys", err)
ctx.InternalServerError(err)
FindAndCount exec two db querys so we should only use it if the function is always used next to a count function
@ -18,15 +18,21 @@ import (
Generally prefer:
@ -267,5 +266,6 @@ func GetCombinedCommitStatusByRef(ctx *context.APIContext) {
intended ... follow up for me in next pull
@ -170,3 +171,4 @@
tagNames := strings.Split(strings.TrimRight(stdout, "\n"), "\n")
tagsTotal := len(tagNames)
if page != 0 {
Probably need to fix this if we're going to offer to page this.
@ -164,15 +167,15 @@ func AddTopic(ctx *context.APIContext) {
}
This should be CountTopics
@ -170,3 +171,4 @@
tagNames := strings.Split(strings.TrimRight(stdout, "\n"), "\n")
tagsTotal := len(tagNames)
if page != 0 {
what do you mean by fix? the git implementation to get tag info to truly paginate?
should use the membersCount provided and drop the CountOrgMembers call below.
@ -164,15 +167,15 @@ func AddTopic(ctx *context.APIContext) {
}
do you mean separate to two functions?
@ -30,3 +35,4 @@
ctx.InternalServerError(err)
return
}
Can't we just get the count here?
@ -170,3 +171,4 @@
tagNames := strings.Split(strings.TrimRight(stdout, "\n"), "\n")
tagsTotal := len(tagNames)
if page != 0 {
leave it for this PR.
@ -164,15 +167,15 @@ func AddTopic(ctx *context.APIContext) {
}
Look at line 180 below.
@ -164,15 +167,15 @@ func AddTopic(ctx *context.APIContext) {
}
it doesnt mather if we use len or the returned value in this case
@ -170,3 +171,4 @@
tagNames := strings.Split(strings.TrimRight(stdout, "\n"), "\n")
tagsTotal := len(tagNames)
if page != 0 {
heh I'm aware of that and the current code too - see TODO 😅
@ -162,3 +162,3 @@
return statuses, x.In("id", ids).Find(&statuses)
return statuses, e.In("id", ids).Find(&statuses)
}
Good catch, this could be back ported
@ -87,7 +83,7 @@ type FindOrgMembersOpts struct {
}
Assume user has joined over 1000 teams? Or we should limit user max joined teams number.
@ -30,3 +35,4 @@
ctx.InternalServerError(err)
return
}
So looking at the code nope - the 2nd return of this function is a map[int64]bool{} saying whether the member is public or not.
@ -162,3 +162,3 @@
return statuses, x.In("id", ids).Find(&statuses)
return statuses, e.In("id", ids).Find(&statuses)
}
-> #16553 😄
@ -87,7 +83,7 @@ type FindOrgMembersOpts struct {
}
this org.getTeams is exactly used as other struct.loadIssues/loadX/loadY/.. functions so I renamed it.
removing it because of speed improvements is not in scope of this pull ... but If you wish I'll add a todo with an open issue to this line?
@ -87,7 +83,7 @@ type FindOrgMembersOpts struct {
}
Yes, I would like to leave it to another PR and not remove the paniation.