mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-04-22 23:19:32 +00:00
feat(repo,locale): merge PR/issues cases for some repo/issue strings (#7092)
- Merge `archive.nocomment` and `comment.blocked_by_user`'s variants for issue and pull request to a unified string and no longer have a issue and pull request variant. - Fixes #6443 Signed-off-by: Ellen Emilia Anna Zscheile <fogti+devel@ytrizja.de> Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7092 Reviewed-by: Panagiotis "Ivory" Vasilopoulos <git@n0toose.net> Reviewed-by: Gusted <gusted@noreply.codeberg.org> Co-authored-by: Ellen Emilia Anna Zscheile <fogti+devel@ytrizja.de> Co-committed-by: Ellen Emilia Anna Zscheile <fogti+devel@ytrizja.de>
This commit is contained in:
parent
3769259c93
commit
b0dd490ae1
5 changed files with 11 additions and 29 deletions
|
@ -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 = 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.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.nocomment = Commenting is not possible because the repository is archived.
|
||||||
archive.pull.nocomment = This repository is archived. You cannot comment on pull requests.
|
|
||||||
archive.pull.noreview = This repository is archived. You cannot review pull requests.
|
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.
|
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.content_history.options = Options
|
||||||
issues.reference_link = Reference: %s
|
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.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.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
|
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.waiting_count_n = %d waiting reviews
|
||||||
pulls.wrong_commit_id = commit id must be a commit id on the target branch
|
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.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_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.
|
pulls.no_merge_helper = Enable merge options in the repository settings or merge the pull request manually.
|
||||||
|
|
|
@ -3255,11 +3255,7 @@ func NewComment(ctx *context.Context) {
|
||||||
comment, err := issue_service.CreateIssueComment(ctx, ctx.Doer, ctx.Repo.Repository, issue, form.Content, attachments)
|
comment, err := issue_service.CreateIssueComment(ctx, ctx.Doer, ctx.Repo.Repository, issue, form.Content, attachments)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if errors.Is(err, user_model.ErrBlockedByUser) {
|
if errors.Is(err, user_model.ErrBlockedByUser) {
|
||||||
if issue.IsPull {
|
ctx.JSONError(ctx.Tr("repo.comment.blocked_by_user"))
|
||||||
ctx.JSONError(ctx.Tr("repo.pulls.comment.blocked_by_user"))
|
|
||||||
} else {
|
|
||||||
ctx.JSONError(ctx.Tr("repo.issues.comment.blocked_by_user"))
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
ctx.ServerError("CreateIssueComment", err)
|
ctx.ServerError("CreateIssueComment", err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1321,8 +1321,8 @@ func MergePullRequest(ctx *context.Context) {
|
||||||
} else if models.IsErrMergeConflicts(err) {
|
} else if models.IsErrMergeConflicts(err) {
|
||||||
conflictError := err.(models.ErrMergeConflicts)
|
conflictError := err.(models.ErrMergeConflicts)
|
||||||
flashError, err := ctx.RenderToHTML(tplAlertDetails, map[string]any{
|
flashError, err := ctx.RenderToHTML(tplAlertDetails, map[string]any{
|
||||||
"Message": ctx.Tr("repo.editor.merge_conflict"),
|
"Message": ctx.Tr("repo.pulls.merge_conflict"),
|
||||||
"Summary": ctx.Tr("repo.editor.merge_conflict_summary"),
|
"Summary": ctx.Tr("repo.pulls.merge_conflict_summary"),
|
||||||
"Details": utils.SanitizeFlashErrorString(conflictError.StdErr) + "<br>" + utils.SanitizeFlashErrorString(conflictError.StdOut),
|
"Details": utils.SanitizeFlashErrorString(conflictError.StdErr) + "<br>" + utils.SanitizeFlashErrorString(conflictError.StdOut),
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -116,29 +116,17 @@
|
||||||
</div>
|
</div>
|
||||||
{{else if .Repository.IsArchived}}
|
{{else if .Repository.IsArchived}}
|
||||||
<div class="ui warning message tw-text-center">
|
<div class="ui warning message tw-text-center">
|
||||||
{{if .Issue.IsPull}}
|
{{ctx.Locale.Tr "repo.archive.nocomment"}}
|
||||||
{{ctx.Locale.Tr "repo.archive.pull.nocomment"}}
|
|
||||||
{{else}}
|
|
||||||
{{ctx.Locale.Tr "repo.archive.issue.nocomment"}}
|
|
||||||
{{end}}
|
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
{{else if .IsBlocked}}
|
{{else if .IsBlocked}}
|
||||||
<div class="ui warning message">
|
<div class="ui warning message">
|
||||||
{{if .Issue.IsPull}}
|
{{ctx.Locale.Tr "repo.comment.blocked_by_user"}}
|
||||||
{{ctx.Locale.Tr "repo.pulls.comment.blocked_by_user"}}
|
|
||||||
{{else}}
|
|
||||||
{{ctx.Locale.Tr "repo.issues.comment.blocked_by_user"}}
|
|
||||||
{{end}}
|
|
||||||
</div>
|
</div>
|
||||||
{{else}} {{/* not .IsSigned */}}
|
{{else}} {{/* not .IsSigned */}}
|
||||||
{{if .Repository.IsArchived}}
|
{{if .Repository.IsArchived}}
|
||||||
<div class="ui warning message tw-text-center">
|
<div class="ui warning message tw-text-center">
|
||||||
{{if .Issue.IsPull}}
|
{{ctx.Locale.Tr "repo.archive.nocomment"}}
|
||||||
{{ctx.Locale.Tr "repo.archive.pull.nocomment"}}
|
|
||||||
{{else}}
|
|
||||||
{{ctx.Locale.Tr "repo.archive.issue.nocomment"}}
|
|
||||||
{{end}}
|
|
||||||
</div>
|
</div>
|
||||||
{{else}}
|
{{else}}
|
||||||
<div class="ui warning message">
|
<div class="ui warning message">
|
||||||
|
|
|
@ -236,7 +236,7 @@ func TestBlockActions(t *testing.T) {
|
||||||
// Ensures that comment creation on doer's owned repositories and doer's
|
// Ensures that comment creation on doer's owned repositories and doer's
|
||||||
// posted issues are blocked.
|
// posted issues are blocked.
|
||||||
t.Run("Comment creation", func(t *testing.T) {
|
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) {
|
t.Run("Blocked by repository owner", func(t *testing.T) {
|
||||||
defer tests.PrintCurrentTest(t)()
|
defer tests.PrintCurrentTest(t)()
|
||||||
|
@ -258,7 +258,7 @@ func TestBlockActions(t *testing.T) {
|
||||||
resp = session.MakeRequest(t, req, http.StatusOK)
|
resp = session.MakeRequest(t, req, http.StatusOK)
|
||||||
htmlDoc := NewHTMLParser(t, resp.Body)
|
htmlDoc := NewHTMLParser(t, resp.Body)
|
||||||
msg := htmlDoc.doc.Find("div .warning").Text()
|
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) {
|
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)
|
resp = session.MakeRequest(t, req, http.StatusOK)
|
||||||
htmlDoc := NewHTMLParser(t, resp.Body)
|
htmlDoc := NewHTMLParser(t, resp.Body)
|
||||||
msg := htmlDoc.doc.Find("div .warning").Text()
|
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)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue