aboutsummaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
Diffstat (limited to 'routers')
-rw-r--r--routers/api/v1/org/team.go2
-rw-r--r--routers/api/v1/repo/issue.go5
-rw-r--r--routers/api/v1/repo/pull.go2
-rw-r--r--routers/events/events.go8
-rw-r--r--routers/org/teams.go4
-rw-r--r--routers/repo/http.go2
-rw-r--r--routers/repo/issue.go2
-rw-r--r--routers/repo/setting_protected_branch.go8
-rw-r--r--routers/user/home.go3
9 files changed, 15 insertions, 21 deletions
diff --git a/routers/api/v1/org/team.go b/routers/api/v1/org/team.go
index 99bbd9eefe..bc86bbcbe3 100644
--- a/routers/api/v1/org/team.go
+++ b/routers/api/v1/org/team.go
@@ -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,
}
diff --git a/routers/api/v1/repo/issue.go b/routers/api/v1/repo/issue.go
index 683a2a43b7..6b46dc0fef 100644
--- a/routers/api/v1/repo/issue.go
+++ b/routers/api/v1/repo/issue.go
@@ -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 {
diff --git a/routers/api/v1/repo/pull.go b/routers/api/v1/repo/pull.go
index 2d16e801db..eff998ee99 100644
--- a/routers/api/v1/repo/pull.go
+++ b/routers/api/v1/repo/pull.go
@@ -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 {
diff --git a/routers/events/events.go b/routers/events/events.go
index 7542f5681a..2c1034038f 100644
--- a/routers/events/events.go
+++ b/routers/events/events.go
@@ -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)
diff --git a/routers/org/teams.go b/routers/org/teams.go
index 520ded33b4..e612cd767c 100644
--- a/routers/org/teams.go
+++ b/routers/org/teams.go
@@ -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)
diff --git a/routers/repo/http.go b/routers/repo/http.go
index 0377979e8b..2b79dddbbd 100644
--- a/routers/repo/http.go
+++ b/routers/repo/http.go
@@ -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
diff --git a/routers/repo/issue.go b/routers/repo/issue.go
index 4475e35f63..da3772ef5a 100644
--- a/routers/repo/issue.go
+++ b/routers/repo/issue.go
@@ -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",
diff --git a/routers/repo/setting_protected_branch.go b/routers/repo/setting_protected_branch.go
index c395a394c2..fba2c095cf 100644
--- a/routers/repo/setting_protected_branch.go
+++ b/routers/repo/setting_protected_branch.go
@@ -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)
}
}
diff --git a/routers/user/home.go b/routers/user/home.go
index 3436a44bae..431ffdde8e 100644
--- a/routers/user/home.go
+++ b/routers/user/home.go
@@ -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 {