Merge remote-tracking branch 'upstream/main' into limit-repo-size

This commit is contained in:
DmitryFrolovTri committed 2023-04-17 06:56:38 +00:00
commit d98a62a2f4
78 files changed
+432 -302

No files matched your search

+10
View File
@@ -7,6 +7,7 @@ import (
"net/http"
"path"
"strings"
"time"
"code.gitea.io/gitea/modules/base"
"code.gitea.io/gitea/modules/context"
@@ -32,5 +33,14 @@ func List(ctx *context.Context) {
}
func Tmpl(ctx *context.Context) {
now := time.Now()
ctx.Data["TimeNow"] = now
ctx.Data["TimePast5s"] = now.Add(-5 * time.Second)
ctx.Data["TimeFuture5s"] = now.Add(5 * time.Second)
ctx.Data["TimePast2m"] = now.Add(-2 * time.Minute)
ctx.Data["TimeFuture2m"] = now.Add(2 * time.Minute)
ctx.Data["TimePast1y"] = now.Add(-1 * 366 * 86400 * time.Second)
ctx.Data["TimeFuture1y"] = now.Add(1 * 366 * 86400 * time.Second)
ctx.HTML(http.StatusOK, base.TplName("devtest"+path.Clean("/"+ctx.Params("sub"))))
}
+1 -6
View File
@@ -12,7 +12,6 @@ import (
repo_model "code.gitea.io/gitea/models/repo"
user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/base"
"code.gitea.io/gitea/modules/charset"
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/git"
@@ -23,10 +22,6 @@ import (
"code.gitea.io/gitea/modules/util"
)
const (
tplBlame base.TplName = "repo/home"
)
type blameRow struct {
RowNumber int
Avatar gotemplate.HTML
@@ -140,7 +135,7 @@ func RefBlame(ctx *context.Context) {
renderBlame(ctx, blameParts, commitNames, previousCommits)
ctx.HTML(http.StatusOK, tplBlame)
ctx.HTML(http.StatusOK, tplRepoHome)
}
func processBlameParts(ctx *context.Context, blameParts []git.BlamePart) (map[string]*user_model.UserCommit, map[string]string) {
+5 -1
View File
@@ -551,7 +551,11 @@ func ParseCompareInfo(ctx *context.Context) *CompareInfo {
ctx.ServerError("GetCompareInfo", err)
return nil
}
ctx.Data["BeforeCommitID"] = ci.CompareInfo.MergeBase
if ci.DirectComparison {
ctx.Data["BeforeCommitID"] = ci.CompareInfo.BaseCommitID
} else {
ctx.Data["BeforeCommitID"] = ci.CompareInfo.MergeBase
}
return ci
}
+8 -8
View File
@@ -964,7 +964,7 @@ func DeleteIssue(ctx *context.Context) {
return
}
if err := issue_service.DeleteIssue(ctx.Doer, ctx.Repo.GitRepo, issue); err != nil {
if err := issue_service.DeleteIssue(ctx, ctx.Doer, ctx.Repo.GitRepo, issue); err != nil {
ctx.ServerError("DeleteIssueByID", err)
return
}
@@ -1132,7 +1132,7 @@ func NewIssuePost(ctx *context.Context) {
Ref: form.Ref,
}
if err := issue_service.NewIssue(repo, issue, labelIDs, attachments, assigneeIDs); err != nil {
if err := issue_service.NewIssue(ctx, repo, issue, labelIDs, attachments, assigneeIDs); err != nil {
if repo_model.IsErrUserDoesNotHaveAccessToRepo(err) {
ctx.Error(http.StatusBadRequest, "UserDoesNotHaveAccessToRepo", err.Error())
return
@@ -2013,7 +2013,7 @@ func UpdateIssueTitle(ctx *context.Context) {
return
}
if err := issue_service.ChangeTitle(issue, ctx.Doer, title); err != nil {
if err := issue_service.ChangeTitle(ctx, issue, ctx.Doer, title); err != nil {
ctx.ServerError("ChangeTitle", err)
return
}
@@ -2037,7 +2037,7 @@ func UpdateIssueRef(ctx *context.Context) {
ref := ctx.FormTrim("ref")
if err := issue_service.ChangeIssueRef(issue, ctx.Doer, ref); err != nil {
if err := issue_service.ChangeIssueRef(ctx, issue, ctx.Doer, ref); err != nil {
ctx.ServerError("ChangeRef", err)
return
}
@@ -2161,7 +2161,7 @@ func UpdateIssueAssignee(ctx *context.Context) {
for _, issue := range issues {
switch action {
case "clear":
if err := issue_service.DeleteNotPassedAssignee(issue, ctx.Doer, []*user_model.User{}); err != nil {
if err := issue_service.DeleteNotPassedAssignee(ctx, issue, ctx.Doer, []*user_model.User{}); err != nil {
ctx.ServerError("ClearAssignees", err)
return
}
@@ -2182,7 +2182,7 @@ func UpdateIssueAssignee(ctx *context.Context) {
return
}
_, _, err = issue_service.ToggleAssignee(issue, ctx.Doer, assigneeID)
_, _, err = issue_service.ToggleAssignee(ctx, issue, ctx.Doer, assigneeID)
if err != nil {
ctx.ServerError("ToggleAssignee", err)
return
@@ -2269,7 +2269,7 @@ func UpdatePullReviewRequest(ctx *context.Context) {
return
}
_, err = issue_service.TeamReviewRequest(issue, ctx.Doer, team, action == "attach")
_, err = issue_service.TeamReviewRequest(ctx, issue, ctx.Doer, team, action == "attach")
if err != nil {
ctx.ServerError("TeamReviewRequest", err)
return
@@ -2307,7 +2307,7 @@ func UpdatePullReviewRequest(ctx *context.Context) {
return
}
_, err = issue_service.ReviewRequest(issue, ctx.Doer, reviewer, action == "attach")
_, err = issue_service.ReviewRequest(ctx, issue, ctx.Doer, reviewer, action == "attach")
if err != nil {
ctx.ServerError("ReviewRequest", err)
return
+1
View File
@@ -24,6 +24,7 @@ func Search(ctx *context.Context) {
Keyword: ctx.FormTrim("q"),
UID: ctx.FormInt64("uid"),
Type: user_model.UserTypeIndividual,
IsActive: ctx.FormOptionalBool("active"),
ListOptions: listOptions,
})
if err != nil {