mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-31 11:52:10 +00:00
Batch of mirror fixes
This commit is contained in:
parent
e573855a4f
commit
7cb5a15c9b
12 changed files with 120 additions and 20 deletions
|
@ -295,5 +295,39 @@ func Comment(ctx *middleware.Context, params martini.Params) {
|
|||
}
|
||||
}
|
||||
|
||||
// Notify watchers.
|
||||
if err = models.NotifyWatchers(&models.Action{ActUserId: ctx.User.Id, ActUserName: ctx.User.Name, ActEmail: ctx.User.Email,
|
||||
OpType: models.OP_COMMENT_ISSUE, Content: fmt.Sprintf("%d|%s", issue.Index, strings.Split(content, "\n")[0]),
|
||||
RepoId: ctx.Repo.Repository.Id, RepoName: ctx.Repo.Repository.Name, RefName: ""}); err != nil {
|
||||
ctx.Handle(500, "issue.CreateIssue(NotifyWatchers)", err)
|
||||
return
|
||||
}
|
||||
|
||||
// Mail watchers and mentions.
|
||||
if base.Service.NotifyMail {
|
||||
issue.Content = content
|
||||
tos, err := mailer.SendIssueNotifyMail(ctx.User, ctx.Repo.Owner, ctx.Repo.Repository, issue)
|
||||
if err != nil {
|
||||
ctx.Handle(500, "issue.Comment(SendIssueNotifyMail)", err)
|
||||
return
|
||||
}
|
||||
|
||||
tos = append(tos, ctx.User.LowerName)
|
||||
ms := base.MentionPattern.FindAllString(issue.Content, -1)
|
||||
newTos := make([]string, 0, len(ms))
|
||||
for _, m := range ms {
|
||||
if com.IsSliceContainsStr(tos, m[1:]) {
|
||||
continue
|
||||
}
|
||||
|
||||
newTos = append(newTos, m[1:])
|
||||
}
|
||||
if err = mailer.SendIssueMentionMail(ctx.Render, ctx.User, ctx.Repo.Owner,
|
||||
ctx.Repo.Repository, issue, models.GetUserEmailsByNames(newTos)); err != nil {
|
||||
ctx.Handle(500, "issue.Comment(SendIssueMentionMail)", err)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
ctx.Redirect(fmt.Sprintf("%s/issues/%d", ctx.Repo.RepoLink, index))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue