Skip to content

Commit 016c2f3

Browse files
authored
Merge branch 'go-gitea:main' into main
2 parents c6acfc1 + 355e9a9 commit 016c2f3

File tree

27 files changed

+280
-68
lines changed

27 files changed

+280
-68
lines changed

models/actions/run.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ func (run *ActionRun) IsSchedule() bool {
171171

172172
func updateRepoRunsNumbers(ctx context.Context, repo *repo_model.Repository) error {
173173
_, err := db.GetEngine(ctx).ID(repo.ID).
174+
NoAutoTime().
174175
SetExpr("num_action_runs",
175176
builder.Select("count(*)").From("action_run").
176177
Where(builder.Eq{"repo_id": repo.ID}),

models/repo/transfer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ func CreatePendingRepositoryTransfer(ctx context.Context, doer, newOwner *user_m
249249
}
250250

251251
repo.Status = RepositoryPendingTransfer
252-
if err := UpdateRepositoryCols(ctx, repo, "status"); err != nil {
252+
if err := UpdateRepositoryColsNoAutoTime(ctx, repo, "status"); err != nil {
253253
return err
254254
}
255255

models/repo/update.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func UpdateRepositoryOwnerNames(ctx context.Context, ownerID int64, ownerName st
2525
}
2626
defer committer.Close()
2727

28-
if _, err := db.GetEngine(ctx).Where("owner_id = ?", ownerID).Cols("owner_name").Update(&Repository{
28+
if _, err := db.GetEngine(ctx).Where("owner_id = ?", ownerID).Cols("owner_name").NoAutoTime().Update(&Repository{
2929
OwnerName: ownerName,
3030
}); err != nil {
3131
return err
@@ -40,8 +40,8 @@ func UpdateRepositoryUpdatedTime(ctx context.Context, repoID int64, updateTime t
4040
return err
4141
}
4242

43-
// UpdateRepositoryCols updates repository's columns
44-
func UpdateRepositoryCols(ctx context.Context, repo *Repository, cols ...string) error {
43+
// UpdateRepositoryColsWithAutoTime updates repository's columns
44+
func UpdateRepositoryColsWithAutoTime(ctx context.Context, repo *Repository, cols ...string) error {
4545
_, err := db.GetEngine(ctx).ID(repo.ID).Cols(cols...).Update(repo)
4646
return err
4747
}

options/locale/locale_zh-CN.ini

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ files=文件
117117

118118
error=错误
119119
error404=您正尝试访问的页面 <strong>不存在</strong> 或 <strong>您尚未被授权</strong> 查看该页面。
120+
error503=服务器无法完成您的请求,请稍后重试。
120121
go_back=返回
121122
invalid_data=无效数据: %v
122123

@@ -129,6 +130,7 @@ pin=固定
129130
unpin=取消置顶
130131

131132
artifacts=制品
133+
expired=已过期
132134
confirm_delete_artifact=您确定要删除制品'%s'吗?
133135

134136
archived=已归档
@@ -449,6 +451,7 @@ use_scratch_code=使用验证口令
449451
twofa_scratch_used=你已经使用了你的验证口令。你将会转到两步验证设置页面以便移除你的注册设备或者重新生成新的验证口令。
450452
twofa_passcode_incorrect=你的验证码不正确。如果你丢失了你的设备,请使用你的验证口令。
451453
twofa_scratch_token_incorrect=你的验证口令不正确。
454+
twofa_required=您必须设置两步验证来访问仓库,或者尝试重新登录。
452455
login_userpass=登录
453456
login_openid=OpenID
454457
oauth_signup_tab=注册帐号
@@ -1524,7 +1527,7 @@ issues.move_to_column_of_project=`将此对象移至 %s 的 %s 中在 %s 上`
15241527
issues.change_milestone_at=`%[3]s 修改了里程碑从 <b>%[1]s</b> 到 <b>%[2]s</b>`
15251528
issues.change_project_at=于 %[3]s 将此从项目 <b>%[1]s</b> 移到 <b>%[2]s</b>
15261529
issues.remove_milestone_at=`%[2]s 删除了里程碑 <b>%[1]s</b>`
1527-
issues.remove_project_at=`<b>%s</b> 项目 %s 中删除`
1530+
issues.remove_project_at=`于 %[2]s 将此工单从项目 <b>%[1]s</b> 中删除`
15281531
issues.deleted_milestone=(已删除)
15291532
issues.deleted_project=`(已删除)`
15301533
issues.self_assign_at=`于 %s 指派给自己`
@@ -1877,6 +1880,7 @@ pulls.add_prefix=添加 <strong>%s</strong> 前缀
18771880
pulls.remove_prefix=删除 <strong>%s</strong> 前缀
18781881
pulls.data_broken=此合并请求因为派生仓库信息缺失而中断。
18791882
pulls.files_conflicted=此合并请求有变更与目标分支冲突。
1883+
pulls.is_checking=正在进行合并冲突检测 ...
18801884
pulls.is_ancestor=此分支已经包含在目标分支中,没有什么可以合并。
18811885
pulls.is_empty=此分支上的更改已经在目标分支上。这将是一个空提交。
18821886
pulls.required_status_check_failed=一些必要的检查没有成功
@@ -3724,7 +3728,11 @@ creation.name_placeholder=不区分大小写,字母数字或下划线不能以
37243728
creation.value_placeholder=输入任何内容,开头和结尾的空白都会被省略
37253729
creation.description_placeholder=输入简短描述(可选)。
37263730

3731+
save_success=密钥 '%s' 保存成功。
3732+
save_failed=密钥保存失败。
37273733

3734+
add_secret=添加密钥
3735+
edit_secret=编辑密钥
37283736
deletion=删除密钥
37293737
deletion.description=删除密钥是永久性的,无法撤消。继续吗?
37303738
deletion.success=此Secret已被删除。
@@ -3841,6 +3849,8 @@ deleted.display_name=已删除项目
38413849
type-1.display_name=个人项目
38423850
type-2.display_name=仓库项目
38433851
type-3.display_name=组织项目
3852+
enter_fullscreen=全屏
3853+
exit_fullscreen=退出全屏
38443854

38453855
[git.filemode]
38463856
changed_filemode=%[1]s -> %[2]s

routers/api/v1/repo/issue.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -895,6 +895,15 @@ func EditIssue(ctx *context.APIContext) {
895895
issue.MilestoneID != *form.Milestone {
896896
oldMilestoneID := issue.MilestoneID
897897
issue.MilestoneID = *form.Milestone
898+
if issue.MilestoneID > 0 {
899+
issue.Milestone, err = issues_model.GetMilestoneByRepoID(ctx, ctx.Repo.Repository.ID, *form.Milestone)
900+
if err != nil {
901+
ctx.APIErrorInternal(err)
902+
return
903+
}
904+
} else {
905+
issue.Milestone = nil
906+
}
898907
if err = issue_service.ChangeMilestoneAssign(ctx, issue, ctx.Doer, oldMilestoneID); err != nil {
899908
ctx.APIErrorInternal(err)
900909
return

routers/api/v1/repo/issue_comment.go

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -609,15 +609,17 @@ func editIssueComment(ctx *context.APIContext, form api.EditIssueCommentOption)
609609
return
610610
}
611611

612-
oldContent := comment.Content
613-
comment.Content = form.Body
614-
if err := issue_service.UpdateComment(ctx, comment, comment.ContentVersion, ctx.Doer, oldContent); err != nil {
615-
if errors.Is(err, user_model.ErrBlockedUser) {
616-
ctx.APIError(http.StatusForbidden, err)
617-
} else {
618-
ctx.APIErrorInternal(err)
612+
if form.Body != comment.Content {
613+
oldContent := comment.Content
614+
comment.Content = form.Body
615+
if err := issue_service.UpdateComment(ctx, comment, comment.ContentVersion, ctx.Doer, oldContent); err != nil {
616+
if errors.Is(err, user_model.ErrBlockedUser) {
617+
ctx.APIError(http.StatusForbidden, err)
618+
} else {
619+
ctx.APIErrorInternal(err)
620+
}
621+
return
619622
}
620-
return
621623
}
622624

623625
ctx.JSON(http.StatusOK, convert.ToAPIComment(ctx, ctx.Repo.Repository, comment))

routers/api/v1/repo/pull.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -706,6 +706,11 @@ func EditPullRequest(ctx *context.APIContext) {
706706
issue.MilestoneID != form.Milestone {
707707
oldMilestoneID := issue.MilestoneID
708708
issue.MilestoneID = form.Milestone
709+
issue.Milestone, err = issues_model.GetMilestoneByRepoID(ctx, ctx.Repo.Repository.ID, form.Milestone)
710+
if err != nil {
711+
ctx.APIErrorInternal(err)
712+
return
713+
}
709714
if err = issue_service.ChangeMilestoneAssign(ctx, issue, ctx.Doer, oldMilestoneID); err != nil {
710715
ctx.APIErrorInternal(err)
711716
return

routers/private/hook_post_receive.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ func HookPostReceive(ctx *gitea_context.PrivateContext) {
220220
}
221221

222222
if len(cols) > 0 {
223-
if err := repo_model.UpdateRepositoryCols(ctx, repo, cols...); err != nil {
223+
if err := repo_model.UpdateRepositoryColsNoAutoTime(ctx, repo, cols...); err != nil {
224224
log.Error("Failed to Update: %s/%s Error: %v", ownerName, repoName, err)
225225
ctx.JSON(http.StatusInternalServerError, private.HookPostReceiveResult{
226226
Err: fmt.Sprintf("Failed to Update: %s/%s Error: %v", ownerName, repoName, err),

routers/web/repo/editor.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -376,12 +376,6 @@ func editFilePost(ctx *context.Context, form forms.EditRepoFileForm, isNewFile b
376376
}
377377
}
378378

379-
if ctx.Repo.Repository.IsEmpty {
380-
if isEmpty, err := ctx.Repo.GitRepo.IsEmpty(); err == nil && !isEmpty {
381-
_ = repo_model.UpdateRepositoryCols(ctx, &repo_model.Repository{ID: ctx.Repo.Repository.ID, IsEmpty: false}, "is_empty")
382-
}
383-
}
384-
385379
redirectForCommitChoice(ctx, form.CommitChoice, branchName, form.TreePath)
386380
}
387381

@@ -790,7 +784,7 @@ func UploadFilePost(ctx *context.Context) {
790784

791785
if ctx.Repo.Repository.IsEmpty {
792786
if isEmpty, err := ctx.Repo.GitRepo.IsEmpty(); err == nil && !isEmpty {
793-
_ = repo_model.UpdateRepositoryCols(ctx, &repo_model.Repository{ID: ctx.Repo.Repository.ID, IsEmpty: false}, "is_empty")
787+
_ = repo_model.UpdateRepositoryColsWithAutoTime(ctx, &repo_model.Repository{ID: ctx.Repo.Repository.ID, IsEmpty: false}, "is_empty")
794788
}
795789
}
796790

routers/web/repo/issue.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,16 @@ func UpdateIssueMilestone(ctx *context.Context) {
418418
continue
419419
}
420420
issue.MilestoneID = milestoneID
421+
if milestoneID > 0 {
422+
var err error
423+
issue.Milestone, err = issues_model.GetMilestoneByRepoID(ctx, ctx.Repo.Repository.ID, milestoneID)
424+
if err != nil {
425+
ctx.ServerError("GetMilestoneByRepoID", err)
426+
return
427+
}
428+
} else {
429+
issue.Milestone = nil
430+
}
421431
if err := issue_service.ChangeMilestoneAssign(ctx, issue, ctx.Doer, oldMilestoneID); err != nil {
422432
ctx.ServerError("ChangeMilestoneAssign", err)
423433
return

0 commit comments

Comments
 (0)