diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index a67f891604..ea7191b906 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1217,8 +1217,7 @@ template.invalid = Must select a template repository archive.title = This repository is archived. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments. archive.title_date = This repository has been archived on %s. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments. -archive.issue.nocomment = This repository is archived. You cannot comment on issues. -archive.pull.nocomment = This repository is archived. You cannot comment on pull requests. +archive.nocomment = Commenting is not possible because the repository is archived. archive.pull.noreview = This repository is archived. You cannot review pull requests. form.reach_limit_of_creation_1 = The owner has already reached the limit of %d repository. @@ -1882,7 +1881,7 @@ issues.content_history.delete_from_history_confirm = Delete from history? issues.content_history.options = Options issues.reference_link = Reference: %s issues.blocked_by_user = You cannot create issues in this repository because you are blocked by the repository owner. -issues.comment.blocked_by_user = You cannot comment on this issue because you are blocked by the repository owner or the poster of the issue. +comment.blocked_by_user = Commenting is not possible because you are blocked by the repository owner or the author. issues.reopen.blocked_by_user = You cannot reopen this issue because you are blocked by the repository owner or the poster of this issue. issues.summary_card_alt = Summary card of an issue titled "%s" in repository %s @@ -1967,7 +1966,6 @@ pulls.waiting_count_1 = %d waiting review pulls.waiting_count_n = %d waiting reviews pulls.wrong_commit_id = commit id must be a commit id on the target branch pulls.blocked_by_user = You cannot create a pull request on this repository because you are blocked by the repository owner. -pulls.comment.blocked_by_user = You cannot comment on this pull request because you are blocked by the repository owner or the poster of the pull request. pulls.no_merge_desc = This pull request cannot be merged because all repository merge options are disabled. pulls.no_merge_helper = Enable merge options in the repository settings or merge the pull request manually. diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go index e51d143ede..dc662a654e 100644 --- a/routers/web/repo/issue.go +++ b/routers/web/repo/issue.go @@ -3255,11 +3255,7 @@ func NewComment(ctx *context.Context) { comment, err := issue_service.CreateIssueComment(ctx, ctx.Doer, ctx.Repo.Repository, issue, form.Content, attachments) if err != nil { if errors.Is(err, user_model.ErrBlockedByUser) { - if issue.IsPull { - ctx.JSONError(ctx.Tr("repo.pulls.comment.blocked_by_user")) - } else { - ctx.JSONError(ctx.Tr("repo.issues.comment.blocked_by_user")) - } + ctx.JSONError(ctx.Tr("repo.comment.blocked_by_user")) } else { ctx.ServerError("CreateIssueComment", err) } diff --git a/routers/web/repo/pull.go b/routers/web/repo/pull.go index bda357fff9..7ae7fd416c 100644 --- a/routers/web/repo/pull.go +++ b/routers/web/repo/pull.go @@ -1321,8 +1321,8 @@ func MergePullRequest(ctx *context.Context) { } else if models.IsErrMergeConflicts(err) { conflictError := err.(models.ErrMergeConflicts) flashError, err := ctx.RenderToHTML(tplAlertDetails, map[string]any{ - "Message": ctx.Tr("repo.editor.merge_conflict"), - "Summary": ctx.Tr("repo.editor.merge_conflict_summary"), + "Message": ctx.Tr("repo.pulls.merge_conflict"), + "Summary": ctx.Tr("repo.pulls.merge_conflict_summary"), "Details": utils.SanitizeFlashErrorString(conflictError.StdErr) + "
" + utils.SanitizeFlashErrorString(conflictError.StdOut), }) if err != nil { diff --git a/templates/repo/issue/view_content.tmpl b/templates/repo/issue/view_content.tmpl index 8ede0f36e5..268c77d880 100644 --- a/templates/repo/issue/view_content.tmpl +++ b/templates/repo/issue/view_content.tmpl @@ -116,29 +116,17 @@ {{else if .Repository.IsArchived}}
- {{if .Issue.IsPull}} - {{ctx.Locale.Tr "repo.archive.pull.nocomment"}} - {{else}} - {{ctx.Locale.Tr "repo.archive.issue.nocomment"}} - {{end}} + {{ctx.Locale.Tr "repo.archive.nocomment"}}
{{end}} {{else if .IsBlocked}}
- {{if .Issue.IsPull}} - {{ctx.Locale.Tr "repo.pulls.comment.blocked_by_user"}} - {{else}} - {{ctx.Locale.Tr "repo.issues.comment.blocked_by_user"}} - {{end}} + {{ctx.Locale.Tr "repo.comment.blocked_by_user"}}
{{else}} {{/* not .IsSigned */}} {{if .Repository.IsArchived}}
- {{if .Issue.IsPull}} - {{ctx.Locale.Tr "repo.archive.pull.nocomment"}} - {{else}} - {{ctx.Locale.Tr "repo.archive.issue.nocomment"}} - {{end}} + {{ctx.Locale.Tr "repo.archive.nocomment"}}
{{else}}
diff --git a/tests/integration/block_test.go b/tests/integration/block_test.go index b0d4f727de..67443f40cf 100644 --- a/tests/integration/block_test.go +++ b/tests/integration/block_test.go @@ -236,7 +236,7 @@ func TestBlockActions(t *testing.T) { // Ensures that comment creation on doer's owned repositories and doer's // posted issues are blocked. t.Run("Comment creation", func(t *testing.T) { - expectedMessage := locale.Tr("repo.issues.comment.blocked_by_user") + expectedMessage := locale.Tr("repo.comment.blocked_by_user") t.Run("Blocked by repository owner", func(t *testing.T) { defer tests.PrintCurrentTest(t)() @@ -258,7 +258,7 @@ func TestBlockActions(t *testing.T) { resp = session.MakeRequest(t, req, http.StatusOK) htmlDoc := NewHTMLParser(t, resp.Body) msg := htmlDoc.doc.Find("div .warning").Text() - assert.Contains(t, msg, "You cannot comment on this issue because you are blocked") + assert.Contains(t, msg, expectedMessage) }) t.Run("Blocked by issue poster", func(t *testing.T) { @@ -285,7 +285,7 @@ func TestBlockActions(t *testing.T) { resp = session.MakeRequest(t, req, http.StatusOK) htmlDoc := NewHTMLParser(t, resp.Body) msg := htmlDoc.doc.Find("div .warning").Text() - assert.Contains(t, msg, "You cannot comment on this issue because you are blocked") + assert.Contains(t, msg, expectedMessage) }) })