alt
+ 鼠标左键 / 回车
排除标签`
issues.filter_label_no_select=所有标签
issues.filter_milestone=里程碑筛选
issues.filter_milestone_no_select=所有里程碑
@@ -974,6 +977,7 @@ issues.review.review=评审
issues.review.reviewers=评审人
issues.review.show_outdated=显示过时的
issues.review.hide_outdated=隐藏过时的
+issues.assignee.error=因为未知原因,并非所有的指派都成功。
pulls.desc=启用合并请求和代码评审。
pulls.new=创建合并请求
@@ -1332,6 +1336,7 @@ settings.protect_this_branch=启用分支保护
settings.protect_this_branch_desc=防止删除并禁用 Git 强制推送到分支。
settings.protect_whitelist_committers=启用推送白名单
settings.protect_whitelist_committers_desc=允许白名单用户或团队推向此分支 (但不强制推送)。
+settings.protect_whitelist_deploy_keys=拥有推送权限的部署密钥白名单
settings.protect_whitelist_users=推送白名单用户:
settings.protect_whitelist_search_users=搜索用户...
settings.protect_whitelist_teams=推送白名单团队:
@@ -1373,6 +1378,21 @@ settings.unarchive.text=取消存档将恢复仓库接收提交,推送,新
settings.unarchive.success=仓库已成功取消归档。
settings.unarchive.error=仓库在撤销归档时出现异常。请通过日志获取详细信息。
settings.update_avatar_success=仓库头像已经更新。
+settings.lfs=LFS
+settings.lfs_filelist=存储在此仓库中的 LFS 文件
+settings.lfs_no_lfs_files=此仓库中没有 LFS 文件
+settings.lfs_findcommits=查找提交
+settings.lfs_lfs_file_no_commits=没有找到关于此 LFS 文件的提交
+settings.lfs_delete=删除 OID 为 %s 的 LFS 文件
+settings.lfs_delete_warning=删除一个 LFS 文件可能导致签出时显示'对象不存在'的错误。确定继续吗?
+settings.lfs_findpointerfiles=查找指针文件
+settings.lfs_pointers.found=找到 %d 个块指针 - %d 个关联, %d 个未关联(%d 个从仓库丢失)
+settings.lfs_pointers.sha=Blob SHA
+settings.lfs_pointers.oid=OID
+settings.lfs_pointers.inRepo=在仓库中
+settings.lfs_pointers.exists=在仓库中存在
+settings.lfs_pointers.accessible=用户可访问
+settings.lfs_pointers.associateAccessible=关联可访问的 %d OID
diff.browse_source=浏览代码
diff.parent=父节点
diff --git a/routers/api/v1/repo/issue_comment.go b/routers/api/v1/repo/issue_comment.go
index 60796031a58..3a5f6d24474 100644
--- a/routers/api/v1/repo/issue_comment.go
+++ b/routers/api/v1/repo/issue_comment.go
@@ -10,7 +10,6 @@ import (
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/context"
- "code.gitea.io/gitea/modules/notification"
api "code.gitea.io/gitea/modules/structs"
comment_service "code.gitea.io/gitea/services/comments"
)
@@ -196,8 +195,6 @@ func CreateIssueComment(ctx *context.APIContext, form api.CreateIssueCommentOpti
return
}
- notification.NotifyCreateIssueComment(ctx.User, ctx.Repo.Repository, issue, comment)
-
ctx.JSON(201, comment.APIFormat())
}
@@ -305,8 +302,6 @@ func editIssueComment(ctx *context.APIContext, form api.EditIssueCommentOption)
return
}
- notification.NotifyUpdateComment(ctx.User, comment, oldContent)
-
ctx.JSON(200, comment.APIFormat())
}
@@ -396,7 +391,5 @@ func deleteIssueComment(ctx *context.APIContext) {
return
}
- notification.NotifyDeleteComment(ctx.User, comment)
-
ctx.Status(204)
}
diff --git a/routers/repo/compare.go b/routers/repo/compare.go
index f8534f68b77..b9e14abfb87 100644
--- a/routers/repo/compare.go
+++ b/routers/repo/compare.go
@@ -339,12 +339,40 @@ func PrepareCompareDiff(
return false
}
+// parseBaseRepoInfo parse base repository if current repo is forked.
+// The "base" here means the repository where current repo forks from,
+// not the repository fetch from current URL.
+func parseBaseRepoInfo(ctx *context.Context, repo *models.Repository) error {
+ if !repo.IsFork {
+ return nil
+ }
+ if err := repo.GetBaseRepo(); err != nil {
+ return err
+ }
+ if err := repo.BaseRepo.GetOwnerName(); err != nil {
+ return err
+ }
+ baseGitRepo, err := git.OpenRepository(models.RepoPath(repo.BaseRepo.OwnerName, repo.BaseRepo.Name))
+ if err != nil {
+ return err
+ }
+ ctx.Data["BaseRepoBranches"], err = baseGitRepo.GetBranches()
+ if err != nil {
+ return err
+ }
+ return nil
+}
+
// CompareDiff show different from one commit to another commit
func CompareDiff(ctx *context.Context) {
headUser, headRepo, headGitRepo, compareInfo, baseBranch, headBranch := ParseCompareInfo(ctx)
if ctx.Written() {
return
}
+ if err := parseBaseRepoInfo(ctx, headRepo); err != nil {
+ ctx.ServerError("parseBaseRepoInfo", err)
+ return
+ }
nothingToCompare := PrepareCompareDiff(ctx, headUser, headRepo, headGitRepo, compareInfo, baseBranch, headBranch)
if ctx.Written() {
diff --git a/routers/repo/issue.go b/routers/repo/issue.go
index 12ff0a054c1..04c718d5b95 100644
--- a/routers/repo/issue.go
+++ b/routers/repo/issue.go
@@ -1066,7 +1066,7 @@ func UpdateIssueContent(ctx *context.Context) {
}
content := ctx.Query("content")
- if err := issue.ChangeContent(ctx.User, content); err != nil {
+ if err := issue_service.ChangeContent(issue, ctx.User, content); err != nil {
ctx.ServerError("ChangeContent", err)
return
}
@@ -1324,8 +1324,6 @@ func NewComment(ctx *context.Context, form auth.CreateCommentForm) {
return
}
- notification.NotifyCreateIssueComment(ctx.User, ctx.Repo.Repository, issue, comment)
-
log.Trace("Comment created: %d/%d/%d", ctx.Repo.Repository.ID, issue.ID, comment.ID)
}
@@ -1375,8 +1373,6 @@ func UpdateCommentContent(ctx *context.Context) {
ctx.ServerError("UpdateAttachments", err)
}
- notification.NotifyUpdateComment(ctx.User, comment, oldContent)
-
ctx.JSON(200, map[string]interface{}{
"content": string(markdown.Render([]byte(comment.Content), ctx.Query("context"), ctx.Repo.Repository.ComposeMetas())),
"attachments": attachmentsHTML(ctx, comment.Attachments),
@@ -1404,13 +1400,11 @@ func DeleteComment(ctx *context.Context) {
return
}
- if err = models.DeleteComment(comment, ctx.User); err != nil {
+ if err = comment_service.DeleteComment(comment, ctx.User); err != nil {
ctx.ServerError("DeleteCommentByID", err)
return
}
- notification.NotifyDeleteComment(ctx.User, comment)
-
ctx.Status(200)
}
diff --git a/services/comments/comments.go b/services/comments/comments.go
index 010c0aaac7b..1ae5e2743fe 100644
--- a/services/comments/comments.go
+++ b/services/comments/comments.go
@@ -11,9 +11,8 @@ import (
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/git"
- "code.gitea.io/gitea/modules/log"
+ "code.gitea.io/gitea/modules/notification"
"code.gitea.io/gitea/modules/setting"
- api "code.gitea.io/gitea/modules/structs"
"code.gitea.io/gitea/services/gitdiff"
)
@@ -31,19 +30,8 @@ func CreateIssueComment(doer *models.User, repo *models.Repository, issue *model
return nil, err
}
- mode, _ := models.AccessLevel(doer, repo)
- if err = models.PrepareWebhooks(repo, models.HookEventIssueComment, &api.IssueCommentPayload{
- Action: api.HookIssueCommentCreated,
- Issue: issue.APIFormat(),
- Comment: comment.APIFormat(),
- Repository: repo.APIFormat(mode),
- Sender: doer.APIFormat(),
- IsPull: issue.IsPull,
- }); err != nil {
- log.Error("PrepareWebhooks [comment_id: %d]: %v", comment.ID, err)
- } else {
- go models.HookQueue.Add(repo.ID)
- }
+ notification.NotifyCreateIssueComment(doer, repo, issue, comment)
+
return comment, nil
}
@@ -106,35 +94,7 @@ func UpdateComment(c *models.Comment, doer *models.User, oldContent string) erro
return err
}
- if err := c.LoadPoster(); err != nil {
- return err
- }
- if err := c.LoadIssue(); err != nil {
- return err
- }
-
- if err := c.Issue.LoadAttributes(); err != nil {
- return err
- }
-
- mode, _ := models.AccessLevel(doer, c.Issue.Repo)
- if err := models.PrepareWebhooks(c.Issue.Repo, models.HookEventIssueComment, &api.IssueCommentPayload{
- Action: api.HookIssueCommentEdited,
- Issue: c.Issue.APIFormat(),
- Comment: c.APIFormat(),
- Changes: &api.ChangesPayload{
- Body: &api.ChangesFromPayload{
- From: oldContent,
- },
- },
- Repository: c.Issue.Repo.APIFormat(mode),
- Sender: doer.APIFormat(),
- IsPull: c.Issue.IsPull,
- }); err != nil {
- log.Error("PrepareWebhooks [comment_id: %d]: %v", c.ID, err)
- } else {
- go models.HookQueue.Add(c.Issue.Repo.ID)
- }
+ notification.NotifyUpdateComment(doer, c, oldContent)
return nil
}
@@ -145,31 +105,7 @@ func DeleteComment(comment *models.Comment, doer *models.User) error {
return err
}
- if err := comment.LoadPoster(); err != nil {
- return err
- }
- if err := comment.LoadIssue(); err != nil {
- return err
- }
-
- if err := comment.Issue.LoadAttributes(); err != nil {
- return err
- }
-
- mode, _ := models.AccessLevel(doer, comment.Issue.Repo)
-
- if err := models.PrepareWebhooks(comment.Issue.Repo, models.HookEventIssueComment, &api.IssueCommentPayload{
- Action: api.HookIssueCommentDeleted,
- Issue: comment.Issue.APIFormat(),
- Comment: comment.APIFormat(),
- Repository: comment.Issue.Repo.APIFormat(mode),
- Sender: doer.APIFormat(),
- IsPull: comment.Issue.IsPull,
- }); err != nil {
- log.Error("PrepareWebhooks [comment_id: %d]: %v", comment.ID, err)
- } else {
- go models.HookQueue.Add(comment.Issue.Repo.ID)
- }
+ notification.NotifyDeleteComment(doer, comment)
return nil
}
diff --git a/services/issue/content.go b/services/issue/content.go
new file mode 100644
index 00000000000..1081e30b5d8
--- /dev/null
+++ b/services/issue/content.go
@@ -0,0 +1,23 @@
+// Copyright 2019 The Gitea Authors. All rights reserved.
+// Use of this source code is governed by a MIT-style
+// license that can be found in the LICENSE file.
+
+package issue
+
+import (
+ "code.gitea.io/gitea/models"
+ "code.gitea.io/gitea/modules/notification"
+)
+
+// ChangeContent changes issue content, as the given user.
+func ChangeContent(issue *models.Issue, doer *models.User, content string) (err error) {
+ oldContent := issue.Content
+
+ if err := issue.ChangeContent(doer, content); err != nil {
+ return err
+ }
+
+ notification.NotifyIssueChangeContent(doer, issue, oldContent)
+
+ return nil
+}
diff --git a/templates/repo/diff/compare.tmpl b/templates/repo/diff/compare.tmpl
index 1c8942d42fe..50a51c44acc 100644
--- a/templates/repo/diff/compare.tmpl
+++ b/templates/repo/diff/compare.tmpl
@@ -28,6 +28,11 @@
{{range .Branches}}