diff --git a/.drone.yml b/.drone.yml index 3d9a62ee73df..c338f5ee52ed 100644 --- a/.drone.yml +++ b/.drone.yml @@ -4,7 +4,7 @@ name: compliance platform: os: linux - arch: arm64 + arch: amd64 trigger: event: @@ -27,7 +27,7 @@ steps: - name: lint-backend pull: always - image: gitea/test_env:linux-arm64 # https://gitea.com/gitea/test-env + image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env commands: - make lint-backend environment: @@ -37,7 +37,7 @@ steps: - name: lint-backend-windows pull: always - image: gitea/test_env:linux-arm64 # https://gitea.com/gitea/test-env + image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env commands: - make golangci-lint vet environment: @@ -49,7 +49,7 @@ steps: - name: lint-backend-gogit pull: always - image: gitea/test_env:linux-arm64 # https://gitea.com/gitea/test-env + image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env commands: - make lint-backend environment: diff --git a/models/action.go b/models/action.go index f6170005c7a6..3462a5e3f009 100644 --- a/models/action.go +++ b/models/action.go @@ -26,31 +26,32 @@ type ActionType int // Possible action types. const ( - ActionCreateRepo ActionType = iota + 1 // 1 - ActionRenameRepo // 2 - ActionStarRepo // 3 - ActionWatchRepo // 4 - ActionCommitRepo // 5 - ActionCreateIssue // 6 - ActionCreatePullRequest // 7 - ActionTransferRepo // 8 - ActionPushTag // 9 - ActionCommentIssue // 10 - ActionMergePullRequest // 11 - ActionCloseIssue // 12 - ActionReopenIssue // 13 - ActionClosePullRequest // 14 - ActionReopenPullRequest // 15 - ActionDeleteTag // 16 - ActionDeleteBranch // 17 - ActionMirrorSyncPush // 18 - ActionMirrorSyncCreate // 19 - ActionMirrorSyncDelete // 20 - ActionApprovePullRequest // 21 - ActionRejectPullRequest // 22 - ActionCommentPull // 23 - ActionPublishRelease // 24 - ActionPullReviewDismissed // 25 + ActionCreateRepo ActionType = iota + 1 // 1 + ActionRenameRepo // 2 + ActionStarRepo // 3 + ActionWatchRepo // 4 + ActionCommitRepo // 5 + ActionCreateIssue // 6 + ActionCreatePullRequest // 7 + ActionTransferRepo // 8 + ActionPushTag // 9 + ActionCommentIssue // 10 + ActionMergePullRequest // 11 + ActionCloseIssue // 12 + ActionReopenIssue // 13 + ActionClosePullRequest // 14 + ActionReopenPullRequest // 15 + ActionDeleteTag // 16 + ActionDeleteBranch // 17 + ActionMirrorSyncPush // 18 + ActionMirrorSyncCreate // 19 + ActionMirrorSyncDelete // 20 + ActionApprovePullRequest // 21 + ActionRejectPullRequest // 22 + ActionCommentPull // 23 + ActionPublishRelease // 24 + ActionPullReviewDismissed // 25 + ActionPullRequestReadyForReview // 26 ) // Action represents user operation type and other information to diff --git a/models/notification.go b/models/notification.go index 56abd0ed8334..c4c7728ad9f6 100644 --- a/models/notification.go +++ b/models/notification.go @@ -207,13 +207,14 @@ func createOrUpdateIssueNotifications(e Engine, issueID, commentID, notification for _, id := range issueWatches { toNotify[id] = struct{}{} } - - repoWatches, err := getRepoWatchersIDs(e, issue.RepoID) - if err != nil { - return err - } - for _, id := range repoWatches { - toNotify[id] = struct{}{} + if !(issue.IsPull && HasWorkInProgressPrefix(issue.Title)) { + repoWatches, err := getRepoWatchersIDs(e, issue.RepoID) + if err != nil { + return err + } + for _, id := range repoWatches { + toNotify[id] = struct{}{} + } } issueParticipants, err := issue.getParticipantIDsByIssue(e) if err != nil { diff --git a/models/pull.go b/models/pull.go index 1abe9fcce7f9..3717878f4201 100644 --- a/models/pull.go +++ b/models/pull.go @@ -595,9 +595,13 @@ func (pr *PullRequest) IsWorkInProgress() bool { log.Error("LoadIssue: %v", err) return false } + return HasWorkInProgressPrefix(pr.Issue.Title) +} +// HasWorkInProgressPrefix determines if the given PR title has a Work In Progress prefix +func HasWorkInProgressPrefix(title string) bool { for _, prefix := range setting.Repository.PullRequest.WorkInProgressPrefixes { - if strings.HasPrefix(strings.ToUpper(pr.Issue.Title), prefix) { + if strings.HasPrefix(strings.ToUpper(title), prefix) { return true } } diff --git a/modules/markup/html.go b/modules/markup/html.go index edf860da4510..0cc0e23b5c57 100644 --- a/modules/markup/html.go +++ b/modules/markup/html.go @@ -304,27 +304,26 @@ func postProcess(ctx *RenderContext, procs []processor, input io.Reader, output _, _ = res.WriteString("") // parse the HTML - nodes, err := html.ParseFragment(res, nil) + node, err := html.Parse(res) if err != nil { return &postProcessError{"invalid HTML", err} } - for _, node := range nodes { - visitNode(ctx, procs, node, true) + if node.Type == html.DocumentNode { + node = node.FirstChild } - newNodes := make([]*html.Node, 0, len(nodes)) + visitNode(ctx, procs, node, true) - for _, node := range nodes { - if node.Data == "html" { - node = node.FirstChild - for node != nil && node.Data != "body" { - node = node.NextSibling - } - } - if node == nil { - continue + newNodes := make([]*html.Node, 0, 5) + + if node.Data == "html" { + node = node.FirstChild + for node != nil && node.Data != "body" { + node = node.NextSibling } + } + if node != nil { if node.Data == "body" { child := node.FirstChild for child != nil { diff --git a/modules/notification/mail/mail.go b/modules/notification/mail/mail.go index 0927e182c18b..5bfb0b3ef8bb 100644 --- a/modules/notification/mail/mail.go +++ b/modules/notification/mail/mail.go @@ -73,6 +73,18 @@ func (m *mailNotifier) NotifyIssueChangeStatus(doer *models.User, issue *models. } } +func (m *mailNotifier) NotifyIssueChangeTitle(doer *models.User, issue *models.Issue, oldTitle string) { + if err := issue.LoadPullRequest(); err != nil { + log.Error("issue.LoadPullRequest: %v", err) + return + } + if issue.IsPull && models.HasWorkInProgressPrefix(oldTitle) && !issue.PullRequest.IsWorkInProgress() { + if err := mailer.MailParticipants(issue, doer, models.ActionPullRequestReadyForReview, nil); err != nil { + log.Error("MailParticipants: %v", err) + } + } +} + func (m *mailNotifier) NotifyNewPullRequest(pr *models.PullRequest, mentions []*models.User) { if err := mailer.MailParticipants(pr.Issue, pr.Issue.Poster, models.ActionCreatePullRequest, mentions); err != nil { log.Error("MailParticipants: %v", err) diff --git a/modules/notification/ui/ui.go b/modules/notification/ui/ui.go index b1374f5608fd..f372d6759ce2 100644 --- a/modules/notification/ui/ui.go +++ b/modules/notification/ui/ui.go @@ -94,6 +94,19 @@ func (ns *notificationService) NotifyIssueChangeStatus(doer *models.User, issue }) } +func (ns *notificationService) NotifyIssueChangeTitle(doer *models.User, issue *models.Issue, oldTitle string) { + if err := issue.LoadPullRequest(); err != nil { + log.Error("issue.LoadPullRequest: %v", err) + return + } + if issue.IsPull && models.HasWorkInProgressPrefix(oldTitle) && !issue.PullRequest.IsWorkInProgress() { + _ = ns.issueQueue.Push(issueNotificationOpts{ + IssueID: issue.ID, + NotificationAuthorID: doer.ID, + }) + } +} + func (ns *notificationService) NotifyMergePullRequest(pr *models.PullRequest, doer *models.User) { _ = ns.issueQueue.Push(issueNotificationOpts{ IssueID: pr.Issue.ID, @@ -106,15 +119,32 @@ func (ns *notificationService) NotifyNewPullRequest(pr *models.PullRequest, ment log.Error("Unable to load issue: %d for pr: %d: Error: %v", pr.IssueID, pr.ID, err) return } - _ = ns.issueQueue.Push(issueNotificationOpts{ - IssueID: pr.Issue.ID, - NotificationAuthorID: pr.Issue.PosterID, - }) + toNotify := make(map[int64]struct{}, 32) + repoWatchers, err := models.GetRepoWatchersIDs(pr.Issue.RepoID) + if err != nil { + log.Error("GetRepoWatchersIDs: %v", err) + return + } + for _, id := range repoWatchers { + toNotify[id] = struct{}{} + } + issueParticipants, err := models.GetParticipantsIDsByIssueID(pr.IssueID) + if err != nil { + log.Error("GetParticipantsIDsByIssueID: %v", err) + return + } + for _, id := range issueParticipants { + toNotify[id] = struct{}{} + } + delete(toNotify, pr.Issue.PosterID) for _, mention := range mentions { + toNotify[mention.ID] = struct{}{} + } + for receiverID := range toNotify { _ = ns.issueQueue.Push(issueNotificationOpts{ IssueID: pr.Issue.ID, NotificationAuthorID: pr.Issue.PosterID, - ReceiverID: mention.ID, + ReceiverID: receiverID, }) } } diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 2fa70679d828..ded76272b64a 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -317,19 +317,64 @@ password_pwned = The password you chose is on a set your password first. + reset_password = Recover your account +reset_password.title = %s, you have requested to recover your account +reset_password.text = Please click the following link to recover your account within %s: + register_success = Registration successful -register_notify = Welcome to Gitea + +issue_assigned.pull = @%[1]s assigned you to the pull request %[2]s in repository %[3]s. +issue_assigned.issue = @%[1]s assigned you to the issue %[2]s in repository %[3]s. + +issue.x_mentioned_you = @%s mentioned you: +issue.action.force_push = %[1]s force-pushed the %[2]s from %[3]s to %[4]s. +issue.action.push_1 = @%[1]s pushed 1 commit to %[2]s +issue.action.push_n = @%[1]s pushed %[3]d commits to %s: %[2]s +issue.action.close = @%[1]s closed #%[2]d. +issue.action.reopen = @%[1]s reopened #%[2]d. +issue.action.merge = @%[1]s merged #%[2]d into #%[3]s. +issue.action.approve = @%[1]s approved this pull request. +issue.action.reject = @%[1]s requested changes on this pull request. +issue.action.review = @%[1]s commented on this pull request. +issue.action.review_dismissed = @%[1]s dismissed last review from %[2]s for this pull request. +issue.action.ready_for_review = @%[1]s marked this pull request ready for review. +issue.action.new = Created #%[2]d. +issue.in_tree_path = In %s: release.new.subject = %s in %s released +release.new.text = @%[1]s released %[2]s in %[3]s +release.title = Title: %s +release.note = Note: +release.downloads = Downloads: +release.download.zip = Source Code (ZIP) +release.download.targz = Source Code (TAR.GZ) repo.transfer.subject_to = %s would like to transfer "%s" to %s repo.transfer.subject_to_you = %s would like to transfer "%s" to you repo.transfer.to_you = you +repo.transfer.body = To accept or reject it visit %s or just ignore it. repo.collaborator.added.subject = %s added you to %s +repo.collaborator.added.text = You have been added as a collaborator of repository: [modal] yes = Yes diff --git a/services/mailer/mail.go b/services/mailer/mail.go index ea3edaa90db6..7494d04f2b5c 100644 --- a/services/mailer/mail.go +++ b/services/mailer/mail.go @@ -22,6 +22,7 @@ import ( "code.gitea.io/gitea/modules/markup" "code.gitea.io/gitea/modules/markup/markdown" "code.gitea.io/gitea/modules/setting" + "code.gitea.io/gitea/modules/templates" "code.gitea.io/gitea/modules/timeutil" "code.gitea.io/gitea/modules/translation" @@ -67,13 +68,14 @@ func sendUserMail(language string, u *models.User, tpl base.TplName, code, subje "ActiveCodeLives": timeutil.MinutesToFriendly(setting.Service.ActiveCodeLives, language), "ResetPwdCodeLives": timeutil.MinutesToFriendly(setting.Service.ResetPwdCodeLives, language), "Code": code, - "i18n": locale, "Language": locale.Language(), + // helper + "i18n": locale, + "Str2html": templates.Str2html, } var content bytes.Buffer - // TODO: i18n templates? if err := bodyTemplates.ExecuteTemplate(&content, string(tpl), data); err != nil { log.Error("Template: %v", err) return @@ -104,13 +106,14 @@ func SendActivateEmailMail(u *models.User, email *models.EmailAddress) { "ActiveCodeLives": timeutil.MinutesToFriendly(setting.Service.ActiveCodeLives, locale.Language()), "Code": u.GenerateEmailActivateCode(email.Email), "Email": email.Email, - "i18n": locale, "Language": locale.Language(), + // helper + "i18n": locale, + "Str2html": templates.Str2html, } var content bytes.Buffer - // TODO: i18n templates? if err := bodyTemplates.ExecuteTemplate(&content, string(mailAuthActivateEmail), data); err != nil { log.Error("Template: %v", err) return @@ -129,13 +132,14 @@ func SendRegisterNotifyMail(u *models.User) { data := map[string]interface{}{ "DisplayName": u.DisplayName(), "Username": u.Name, - "i18n": locale, "Language": locale.Language(), + // helper + "i18n": locale, + "Str2html": templates.Str2html, } var content bytes.Buffer - // TODO: i18n templates? if err := bodyTemplates.ExecuteTemplate(&content, string(mailAuthRegisterNotify), data); err != nil { log.Error("Template: %v", err) return @@ -157,13 +161,14 @@ func SendCollaboratorMail(u, doer *models.User, repo *models.Repository) { "Subject": subject, "RepoName": repoName, "Link": repo.HTMLURL(), - "i18n": locale, "Language": locale.Language(), + // helper + "i18n": locale, + "Str2html": templates.Str2html, } var content bytes.Buffer - // TODO: i18n templates? if err := bodyTemplates.ExecuteTemplate(&content, string(mailNotifyCollaborator), data); err != nil { log.Error("Template: %v", err) return @@ -239,12 +244,13 @@ func composeIssueCommentMessages(ctx *mailCommentContext, lang string, recipient "ActionType": actType, "ActionName": actName, "ReviewComments": reviewComments, - "i18n": locale, "Language": locale.Language(), + // helper + "i18n": locale, + "Str2html": templates.Str2html, } var mailSubject bytes.Buffer - // TODO: i18n templates? if err := subjectTemplates.ExecuteTemplate(&mailSubject, string(tplName), mailMeta); err == nil { subject = sanitizeSubject(mailSubject.String()) if subject == "" { @@ -260,7 +266,6 @@ func composeIssueCommentMessages(ctx *mailCommentContext, lang string, recipient var mailBody bytes.Buffer - // TODO: i18n templates? if err := bodyTemplates.ExecuteTemplate(&mailBody, string(tplName), mailMeta); err != nil { log.Error("ExecuteTemplate [%s]: %v", string(tplName)+"/body", err) } @@ -377,6 +382,8 @@ func actionToTemplate(issue *models.Issue, actionType models.ActionType, name = "merge" case models.ActionPullReviewDismissed: name = "review_dismissed" + case models.ActionPullRequestReadyForReview: + name = "ready_for_review" default: switch commentType { case models.CommentTypeReview: diff --git a/services/mailer/mail_issue.go b/services/mailer/mail_issue.go index 867aa3251750..6ffc08c8c089 100644 --- a/services/mailer/mail_issue.go +++ b/services/mailer/mail_issue.go @@ -30,7 +30,7 @@ const ( // mailIssueCommentToParticipants can be used for both new issue creation and comment. // This function sends two list of emails: -// 1. Repository watchers and users who are participated in comments. +// 1. Repository watchers (except for WIP pull requests) and users who are participated in comments. // 2. Users who are not in 1. but get mentioned in current issue/comment. func mailIssueCommentToParticipants(ctx *mailCommentContext, mentions []*models.User) error { @@ -74,11 +74,13 @@ func mailIssueCommentToParticipants(ctx *mailCommentContext, mentions []*models. // =========== Repo watchers =========== // Make repo watchers last, since it's likely the list with the most users - ids, err = models.GetRepoWatchersIDs(ctx.Issue.RepoID) - if err != nil { - return fmt.Errorf("GetRepoWatchersIDs(%d): %v", ctx.Issue.RepoID, err) + if !(ctx.Issue.IsPull && ctx.Issue.PullRequest.IsWorkInProgress() && ctx.ActionType != models.ActionCreatePullRequest) { + ids, err = models.GetRepoWatchersIDs(ctx.Issue.RepoID) + if err != nil { + return fmt.Errorf("GetRepoWatchersIDs(%d): %v", ctx.Issue.RepoID, err) + } + unfiltered = append(ids, unfiltered...) } - unfiltered = append(ids, unfiltered...) visited := make(map[int64]bool, len(unfiltered)+len(mentions)+1) diff --git a/services/mailer/mail_release.go b/services/mailer/mail_release.go index 1e12fe13acde..ff008be1d8b8 100644 --- a/services/mailer/mail_release.go +++ b/services/mailer/mail_release.go @@ -13,6 +13,7 @@ import ( "code.gitea.io/gitea/modules/markup" "code.gitea.io/gitea/modules/markup/markdown" "code.gitea.io/gitea/modules/setting" + "code.gitea.io/gitea/modules/templates" "code.gitea.io/gitea/modules/translation" ) @@ -63,13 +64,14 @@ func mailNewRelease(lang string, tos []string, rel *models.Release) { mailMeta := map[string]interface{}{ "Release": rel, "Subject": subject, - "i18n": locale, "Language": locale.Language(), + // helper + "i18n": locale, + "Str2html": templates.Str2html, } var mailBody bytes.Buffer - // TODO: i18n templates? if err := bodyTemplates.ExecuteTemplate(&mailBody, string(tplNewReleaseMail), mailMeta); err != nil { log.Error("ExecuteTemplate [%s]: %v", string(tplNewReleaseMail)+"/body", err) return diff --git a/services/mailer/mail_repo.go b/services/mailer/mail_repo.go index c742101ee196..5ef67b7c6574 100644 --- a/services/mailer/mail_repo.go +++ b/services/mailer/mail_repo.go @@ -9,6 +9,7 @@ import ( "fmt" "code.gitea.io/gitea/models" + "code.gitea.io/gitea/modules/templates" "code.gitea.io/gitea/modules/translation" ) @@ -57,12 +58,13 @@ func sendRepoTransferNotifyMailPerLang(lang string, newOwner, doer *models.User, "Repo": repo.FullName(), "Link": repo.HTMLURL(), "Subject": subject, - "i18n": locale, "Language": locale.Language(), "Destination": destination, + // helper + "i18n": locale, + "Str2html": templates.Str2html, } - // TODO: i18n templates? if err := bodyTemplates.ExecuteTemplate(&content, string(mailRepoTransferNotify), data); err != nil { return err } diff --git a/templates/mail/auth/activate.tmpl b/templates/mail/auth/activate.tmpl index 37fdbd7c7ce4..1f0204157895 100644 --- a/templates/mail/auth/activate.tmpl +++ b/templates/mail/auth/activate.tmpl @@ -2,14 +2,15 @@ - {{.DisplayName}}, please activate your account + {{.i18n.Tr "mail.activate_account.title" .DisplayName}} +{{ $activate_url := printf "%suser/activate?code=%s" AppUrl .Code}} -

Hi {{.DisplayName}}, thanks for registering at {{AppName}}!

-

Please click the following link to activate your account within {{.ActiveCodeLives}}:

-

{{AppUrl}}user/activate?code={{.Code}}

-

Not working? Try copying and pasting it to your browser.

+

{{.i18n.Tr "mail.activate_account.test_1" .DisplayName AppName | Str2html}}


+

{{.i18n.Tr "mail.activate_account.test_2" .ActiveCodeLives | Str2html}}

{{$activate_url}}


+

{{.i18n.Tr "mail.link_not_working_do_paste" .DisplayName AppName | Str2html}}

+

© {{AppName}}

diff --git a/templates/mail/auth/activate_email.tmpl b/templates/mail/auth/activate_email.tmpl index ebcaa0ee79e0..27cff3ba4c51 100644 --- a/templates/mail/auth/activate_email.tmpl +++ b/templates/mail/auth/activate_email.tmpl @@ -2,14 +2,15 @@ - {{.DisplayName}}, please verify your e-mail address + {{.i18n.Tr "mail.activate_email.title" .DisplayName}} +{{ $activate_url := printf "%suser/activate_email?code=%s&email=%s" AppUrl .Code .Email}} -

Hi {{.DisplayName}},

-

Please click the following link to verify your email address within {{.ActiveCodeLives}}:

-

{{AppUrl}}user/activate_email?code={{.Code}}&email={{.Email}}

-

Not working? Try copying and pasting it to your browser.

+

{{.i18n.Tr "mail.hi_user_x" .DisplayName | Str2html}}


+

{{.i18n.Tr "mail.activate_email.text" .ActiveCodeLives | Str2html}}

{{$activate_url}}


+

{{.i18n.Tr "mail.link_not_working_do_paste" .DisplayName AppName | Str2html}}

+

© {{AppName}}

diff --git a/templates/mail/auth/register_notify.tmpl b/templates/mail/auth/register_notify.tmpl index ea1857030aba..e1ab97b760e1 100644 --- a/templates/mail/auth/register_notify.tmpl +++ b/templates/mail/auth/register_notify.tmpl @@ -2,14 +2,16 @@ - {{.DisplayName}}, welcome to {{AppName}} + {{.i18n.Tr "mail.register_notify.title" .DisplayName AppName}} +{{$set_pwd_url := printf "%[1]suser/forgot_password" AppUrl}} -

Hi {{.DisplayName}}, this is your registration confirmation email for {{AppName}}!

-

You can now login via username: {{.Username}}.

-

{{AppUrl}}user/login

-

If this account has been created for you, please set your password first.

+

{{.i18n.Tr "mail.hi_user_x" .DisplayName | Str2html}}


+

{{.i18n.Tr "mail.register_notify.text_1" AppName}}


+

{{.i18n.Tr "mail.register_notify.text_2" .Username}}

{{AppUrl}}user/login


+

{{.i18n.Tr "mail.register_notify.text_3" $set_pwd_url | Str2html}}


+

© {{AppName}}

diff --git a/templates/mail/auth/reset_passwd.tmpl b/templates/mail/auth/reset_passwd.tmpl index e01d57cea25e..2a85abc6c580 100644 --- a/templates/mail/auth/reset_passwd.tmpl +++ b/templates/mail/auth/reset_passwd.tmpl @@ -2,15 +2,15 @@ - {{.DisplayName}}, you have requested to recover your account + {{.i18n.Tr "mail.reset_password.title" .DisplayName}} +{{ $recover_url := printf "%suser/recover_account?code=%s" AppUrl .Code}} -

Hi {{.DisplayName}},

-

Please click the following link to recover your account within {{.ResetPwdCodeLives}}:

+

{{.i18n.Tr "mail.hi_user_x" .DisplayName | Str2html}}


+

{{.i18n.Tr "mail.reset_password.text" .ResetPwdCodeLives | Str2html}}

{{$recover_url}}


+

{{.i18n.Tr "mail.link_not_working_do_paste" .DisplayName AppName | Str2html}}

-

{{AppUrl}}user/recover_account?code={{.Code}}

-

Not working? Try copying and pasting it to your browser.

© {{AppName}}

diff --git a/templates/mail/issue/assigned.tmpl b/templates/mail/issue/assigned.tmpl index 5b0d2526f125..61e4a44f024f 100644 --- a/templates/mail/issue/assigned.tmpl +++ b/templates/mail/issue/assigned.tmpl @@ -8,13 +8,21 @@ {{.Subject}} +{{$repo_url := printf "%s" .Release.Repo.HTMLURL .Release.Repo.FullName}} +{{$link := printf "#%d" .Link .Issue.Index}} -

@{{.Doer.Name}} assigned you to the {{if .IsPull}}pull request{{else}}issue{{end}} #{{.Issue.Index}} in repository {{.Repo}}.

+

+ {{if .IsPull}} + {{.i18n.Tr "mail.issue_assigned.pull" .Doer.Name $link $repo_url | Str2html}} + {{else}} + {{.i18n.Tr "mail.issue_assigned.issue" .Doer.Name $link $repo_url | Str2html}} + {{end}} +

diff --git a/templates/mail/issue/default.tmpl b/templates/mail/issue/default.tmpl index 4b492dad8ad1..61fe02037c55 100644 --- a/templates/mail/issue/default.tmpl +++ b/templates/mail/issue/default.tmpl @@ -16,53 +16,57 @@ - {{if .IsMention}}

@{{.Doer.Name}} mentioned you:

{{end}} + {{if .IsMention}}

{{.i18n.Tr "mail.issue.x_mentioned_you" .Doer.Name | Str2html}}

{{end}} {{if eq .ActionName "push"}}

- {{.Doer.Name}} {{if .Comment.IsForcePush}} - {{ $oldCommitLink:= printf "%s%s/%s/commit/%s" AppUrl .Comment.Issue.PullRequest.BaseRepo.OwnerName .Comment.Issue.PullRequest.BaseRepo.Name .Comment.OldCommit}} - {{ $newCommitLink:= printf "%s%s/%s/commit/%s" AppUrl .Comment.Issue.PullRequest.BaseRepo.OwnerName .Comment.Issue.PullRequest.BaseRepo.Name .Comment.NewCommit}} - force-pushed the {{.Comment.Issue.PullRequest.HeadBranch}} from - {{ShortSha .Comment.OldCommit}} - to - {{ShortSha .Comment.NewCommit}}. + {{$oldCommitUrl := printf "%s%s/%s/commit/%s" AppUrl .Comment.Issue.PullRequest.BaseRepo.OwnerName .Comment.Issue.PullRequest.BaseRepo.Name .Comment.OldCommit}} + {{$oldShortSha := ShortSha .Comment.OldCommit}} + {{$oldCommitLink := printf "%[2]s" $oldCommitUrl $oldShortSha}} + + {{$newCommitUrl := printf "%s%s/%s/commit/%s" AppUrl .Comment.Issue.PullRequest.BaseRepo.OwnerName .Comment.Issue.PullRequest.BaseRepo.Name .Comment.NewCommit}} + {{$newShortSha := ShortSha .Comment.NewCommit}} + {{$newCommitLink := printf "%[2]s" $newCommitUrl $newShortSha}} + + {{.i18n.Tr "mail.issue.action.force_push" .Doer.Name .Comment.Issue.PullRequest.HeadBranch $oldCommitLink $newCommitLink | Str2html}} {{else}} {{if eq .Comment.Commits.Len 1}} - {{printf "pushed 1 commit to %s:" .Comment.Issue.PullRequest.HeadBranch}} + {{.i18n.Tr "mail.issue.action.push_1" .Doer.Name .Comment.Issue.PullRequest.HeadBranch | Str2html}} {{else}} - {{printf "pushed %d commits to %s:" .Comment.Commits.Len .Comment.Issue.PullRequest.HeadBranch}} + {{.i18n.Tr "mail.issue.action.push_1" .Doer.Name .Comment.Issue.PullRequest.HeadBranch .Comment.Commits.Len | Str2html}} {{end}} {{end}}

{{end}}

{{if eq .ActionName "close"}} - Closed #{{.Issue.Index}}. + {{.i18n.Tr "mail.issue.action.close" .Doer.Name .Issue.Index | Str2html}} {{else if eq .ActionName "reopen"}} - Reopened #{{.Issue.Index}}. + {{.i18n.Tr "mail.issue.action.reopen" .Doer.Name .Issue.Index | Str2html}} {{else if eq .ActionName "merge"}} - Merged #{{.Issue.Index}} into {{.Issue.PullRequest.BaseBranch}}. + {{.i18n.Tr "mail.issue.action.merge" .Doer.Name .Issue.Index .Issue.PullRequest.BaseBranch | Str2html}} {{else if eq .ActionName "approve"}} - @{{.Doer.Name}} approved this pull request. + {{.i18n.Tr "mail.issue.action.approve" .Doer.Name | Str2html}} {{else if eq .ActionName "reject"}} - @{{.Doer.Name}} requested changes on this pull request. + {{.i18n.Tr "mail.issue.action.reject" .Doer.Name | Str2html}} {{else if eq .ActionName "review"}} - @{{.Doer.Name}} commented on this pull request. + {{.i18n.Tr "mail.issue.action.review" .Doer.Name | Str2html}} {{else if eq .ActionName "review_dismissed"}} - @{{.Doer.Name}} dismissed last review from {{.Comment.Review.Reviewer.Name}} for this pull request. + {{.i18n.Tr "mail.issue.action.review_dismissed" .Doer.Name .Comment.Review.Reviewer.Name | Str2html}} + {{else if eq .ActionName "ready_for_review"}} + {{.i18n.Tr "mail.issue.action.ready_for_review" .Doer.Name | Str2html}} {{end}} {{- if eq .Body ""}} {{if eq .ActionName "new"}} - Created #{{.Issue.Index}}. + {{.i18n.Tr "mail.issue.action.new" .Doer.Name .Issue.Index | Str2html}} {{end}} {{else}} {{.Body | Str2html}} {{end -}} {{- range .ReviewComments}}


- In {{.TreePath}}: + {{.i18n.Tr "mail.issue.in_tree_path" .TreePath}}
{{.Patch}}
{{.RenderedContent | Safe}}
@@ -85,7 +89,7 @@

---
- View it on {{AppName}}. + {{.i18n.Tr "mail.view_it_on" AppName}}.

diff --git a/templates/mail/notify/collaborator.tmpl b/templates/mail/notify/collaborator.tmpl index 19a24310233d..baa46bafda9d 100644 --- a/templates/mail/notify/collaborator.tmpl +++ b/templates/mail/notify/collaborator.tmpl @@ -9,12 +9,12 @@ -

You have been added as a collaborator of repository: {{.RepoName}}

+

{{.i18n.Tr "mail.repo.collaborator.added.text"}} {{.RepoName}}

diff --git a/templates/mail/notify/repo_transfer.tmpl b/templates/mail/notify/repo_transfer.tmpl index e0dca8869d66..4dea9474016d 100644 --- a/templates/mail/notify/repo_transfer.tmpl +++ b/templates/mail/notify/repo_transfer.tmpl @@ -5,13 +5,14 @@ {{.Subject}} +{{$url := printf "%[2]s" .Link .Repo}}

{{.Subject}}. - To accept or reject it visit {{.Repo}} or just ignore it. + {{.i18n.Tr "mail.repo.transfer.body" $url | Str2html}}

---
- View it on {{AppName}}. + {{.i18n.Tr "mail.view_it_on" AppName}}.

diff --git a/templates/mail/release.tmpl b/templates/mail/release.tmpl index 7829bce24351..fabe4999e30f 100644 --- a/templates/mail/release.tmpl +++ b/templates/mail/release.tmpl @@ -11,14 +11,15 @@ +{{$release_url := printf "%s" .Release.HTMLURL .Release.TagName}} +{{$repo_url := printf "%s" .Release.Repo.HTMLURL .Release.Repo.FullName}}

- @{{.Release.Publisher.Name}} released {{.Release.TagName}} - in {{.Release.Repo.FullName}} + {{.i18n.Tr "mail.release.new.text" .Release.Publisher.Name $release_url $repo_url | Str2html}}

-

Title: {{.Release.Title}}

+

{{.i18n.Tr "mail.release.title" .Release.Title}}

- Note:
+ {{.i18n.Tr "mail.release.note"}}
{{- if eq .Release.RenderedNote ""}} {{else}} {{.Release.RenderedNote | Str2html}} @@ -28,13 +29,15 @@

---
- Downloads: + {{.i18n.Tr "mail.release.downloads"}}