Code Formats, Nits & Unused Func/Var deletions (#15286)
* _ to unused func options * rm useless brakets * rm trifial non used models functions * rm dead code * rm dead global vars * fix routers/api/v1/repo/issue.go * dont overload import module
This commit is contained in:
parent
0991f9aa42
commit
9c4601bdf8
33 changed files with 41 additions and 98 deletions
|
@ -660,7 +660,7 @@ func SearchTeam(ctx *context.APIContext) {
|
|||
UserID: ctx.User.ID,
|
||||
Keyword: strings.TrimSpace(ctx.Query("q")),
|
||||
OrgID: ctx.Org.Organization.ID,
|
||||
IncludeDesc: (ctx.Query("include_desc") == "" || ctx.QueryBool("include_desc")),
|
||||
IncludeDesc: ctx.Query("include_desc") == "" || ctx.QueryBool("include_desc"),
|
||||
ListOptions: listOptions,
|
||||
}
|
||||
|
||||
|
|
|
@ -141,7 +141,6 @@ func SearchIssues(ctx *context.APIContext) {
|
|||
keyword = ""
|
||||
}
|
||||
var issueIDs []int64
|
||||
var labelIDs []int64
|
||||
if len(keyword) > 0 && len(repoIDs) > 0 {
|
||||
if issueIDs, err = issue_indexer.SearchIssuesByKeyword(repoIDs, keyword); err != nil {
|
||||
ctx.Error(http.StatusInternalServerError, "SearchIssuesByKeyword", err)
|
||||
|
@ -176,7 +175,7 @@ func SearchIssues(ctx *context.APIContext) {
|
|||
|
||||
// Only fetch the issues if we either don't have a keyword or the search returned issues
|
||||
// This would otherwise return all issues if no issues were found by the search.
|
||||
if len(keyword) == 0 || len(issueIDs) > 0 || len(labelIDs) > 0 {
|
||||
if len(keyword) == 0 || len(issueIDs) > 0 || len(includedLabelNames) > 0 {
|
||||
issuesOpt := &models.IssuesOptions{
|
||||
ListOptions: models.ListOptions{
|
||||
Page: ctx.QueryInt("page"),
|
||||
|
@ -675,7 +674,7 @@ func EditIssue(ctx *context.APIContext) {
|
|||
}
|
||||
}
|
||||
if form.State != nil {
|
||||
issue.IsClosed = (api.StateClosed == api.StateType(*form.State))
|
||||
issue.IsClosed = api.StateClosed == api.StateType(*form.State)
|
||||
}
|
||||
statusChangeComment, titleChanged, err := models.UpdateIssueByAPI(issue, ctx.User)
|
||||
if err != nil {
|
||||
|
|
|
@ -580,7 +580,7 @@ func EditPullRequest(ctx *context.APIContext) {
|
|||
}
|
||||
|
||||
if form.State != nil {
|
||||
issue.IsClosed = (api.StateClosed == api.StateType(*form.State))
|
||||
issue.IsClosed = api.StateClosed == api.StateType(*form.State)
|
||||
}
|
||||
statusChangeComment, titleChanged, err := models.UpdateIssueByAPI(issue, ctx.User)
|
||||
if err != nil {
|
||||
|
|
|
@ -32,10 +32,10 @@ func Events(ctx *context.Context) {
|
|||
|
||||
if !ctx.IsSigned {
|
||||
// Return unauthorized status event
|
||||
event := (&eventsource.Event{
|
||||
event := &eventsource.Event{
|
||||
Name: "close",
|
||||
Data: "unauthorized",
|
||||
})
|
||||
}
|
||||
_, _ = event.WriteTo(ctx)
|
||||
ctx.Resp.Flush()
|
||||
return
|
||||
|
@ -137,10 +137,10 @@ loop:
|
|||
break loop
|
||||
}
|
||||
// Replace the event - we don't want to expose the session ID to the user
|
||||
event = (&eventsource.Event{
|
||||
event = &eventsource.Event{
|
||||
Name: "logout",
|
||||
Data: "elsewhere",
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
_, err := event.WriteTo(ctx.Resp)
|
||||
|
|
|
@ -193,7 +193,7 @@ func NewTeamPost(ctx *context.Context) {
|
|||
ctx.Data["PageIsOrgTeams"] = true
|
||||
ctx.Data["PageIsOrgTeamsNew"] = true
|
||||
ctx.Data["Units"] = models.Units
|
||||
var includesAllRepositories = (form.RepoAccess == "all")
|
||||
var includesAllRepositories = form.RepoAccess == "all"
|
||||
|
||||
t := &models.Team{
|
||||
OrgID: ctx.Org.Organization.ID,
|
||||
|
@ -286,7 +286,7 @@ func EditTeamPost(ctx *context.Context) {
|
|||
|
||||
isAuthChanged := false
|
||||
isIncludeAllChanged := false
|
||||
var includesAllRepositories = (form.RepoAccess == "all")
|
||||
var includesAllRepositories = form.RepoAccess == "all"
|
||||
if !t.IsOwnerTeam() {
|
||||
// Validate permission level.
|
||||
auth := models.ParseAccessMode(form.Permission)
|
||||
|
|
|
@ -91,7 +91,7 @@ func httpBase(ctx *context.Context) (h *serviceHandler) {
|
|||
strings.HasSuffix(ctx.Req.URL.Path, "git-upload-archive") {
|
||||
isPull = true
|
||||
} else {
|
||||
isPull = (ctx.Req.Method == "GET")
|
||||
isPull = ctx.Req.Method == "GET"
|
||||
}
|
||||
|
||||
var accessMode models.AccessMode
|
||||
|
|
|
@ -52,8 +52,6 @@ const (
|
|||
)
|
||||
|
||||
var (
|
||||
// ErrTooManyFiles upload too many files
|
||||
ErrTooManyFiles = errors.New("Maximum number of files to upload exceeded")
|
||||
// IssueTemplateCandidates issue templates
|
||||
IssueTemplateCandidates = []string{
|
||||
"ISSUE_TEMPLATE.md",
|
||||
|
|
|
@ -130,16 +130,16 @@ func SettingsProtectedBranch(c *context.Context) {
|
|||
c.Data["merge_whitelist_users"] = strings.Join(base.Int64sToStrings(protectBranch.MergeWhitelistUserIDs), ",")
|
||||
c.Data["approvals_whitelist_users"] = strings.Join(base.Int64sToStrings(protectBranch.ApprovalsWhitelistUserIDs), ",")
|
||||
contexts, _ := models.FindRepoRecentCommitStatusContexts(c.Repo.Repository.ID, 7*24*time.Hour) // Find last week status check contexts
|
||||
for _, context := range protectBranch.StatusCheckContexts {
|
||||
for _, ctx := range protectBranch.StatusCheckContexts {
|
||||
var found bool
|
||||
for _, ctx := range contexts {
|
||||
if ctx == context {
|
||||
for i := range contexts {
|
||||
if contexts[i] == ctx {
|
||||
found = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
contexts = append(contexts, context)
|
||||
contexts = append(contexts, ctx)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -770,9 +770,6 @@ func getActiveTeamOrOrgRepoIds(ctxUser *models.User, team *models.Team, unitType
|
|||
|
||||
if team != nil {
|
||||
env = ctxUser.AccessibleTeamReposEnv(team)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("AccessibleTeamReposEnv: %v", err)
|
||||
}
|
||||
} else {
|
||||
env, err = ctxUser.AccessibleReposEnv(ctxUser.ID)
|
||||
if err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue