"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "modules/notification/mail/mail.go" between
gitea-1.13.1.tar.gz and gitea-1.13.2.tar.gz

About: Gitea allows to set up a self-hosted code hosting Git service (a fork of Gogs).

mail.go  (gitea-1.13.1):mail.go  (gitea-1.13.2)
skipping to change at line 30 skipping to change at line 30
var ( var (
_ base.Notifier = &mailNotifier{} _ base.Notifier = &mailNotifier{}
) )
// NewNotifier create a new mailNotifier notifier // NewNotifier create a new mailNotifier notifier
func NewNotifier() base.Notifier { func NewNotifier() base.Notifier {
return &mailNotifier{} return &mailNotifier{}
} }
func (m *mailNotifier) NotifyCreateIssueComment(doer *models.User, repo *models. Repository, func (m *mailNotifier) NotifyCreateIssueComment(doer *models.User, repo *models. Repository,
issue *models.Issue, comment *models.Comment) { issue *models.Issue, comment *models.Comment, mentions []*models.User) {
var act models.ActionType var act models.ActionType
if comment.Type == models.CommentTypeClose { if comment.Type == models.CommentTypeClose {
act = models.ActionCloseIssue act = models.ActionCloseIssue
} else if comment.Type == models.CommentTypeReopen { } else if comment.Type == models.CommentTypeReopen {
act = models.ActionReopenIssue act = models.ActionReopenIssue
} else if comment.Type == models.CommentTypeComment { } else if comment.Type == models.CommentTypeComment {
act = models.ActionCommentIssue act = models.ActionCommentIssue
} else if comment.Type == models.CommentTypeCode { } else if comment.Type == models.CommentTypeCode {
act = models.ActionCommentIssue act = models.ActionCommentIssue
} else if comment.Type == models.CommentTypePullPush { } else if comment.Type == models.CommentTypePullPush {
act = 0 act = 0
} }
if err := mailer.MailParticipantsComment(comment, act, issue); err != nil { if err := mailer.MailParticipantsComment(comment, act, issue, mentions); err != nil {
log.Error("MailParticipantsComment: %v", err) log.Error("MailParticipantsComment: %v", err)
} }
} }
func (m *mailNotifier) NotifyNewIssue(issue *models.Issue) { func (m *mailNotifier) NotifyNewIssue(issue *models.Issue, mentions []*models.Us
if err := mailer.MailParticipants(issue, issue.Poster, models.ActionCreat er) {
eIssue); err != nil { if err := mailer.MailParticipants(issue, issue.Poster, models.ActionCreat
eIssue, mentions); err != nil {
log.Error("MailParticipants: %v", err) log.Error("MailParticipants: %v", err)
} }
} }
func (m *mailNotifier) NotifyIssueChangeStatus(doer *models.User, issue *models. Issue, actionComment *models.Comment, isClosed bool) { func (m *mailNotifier) NotifyIssueChangeStatus(doer *models.User, issue *models. Issue, actionComment *models.Comment, isClosed bool) {
var actionType models.ActionType var actionType models.ActionType
issue.Content = "" issue.Content = ""
if issue.IsPull { if issue.IsPull {
if isClosed { if isClosed {
actionType = models.ActionClosePullRequest actionType = models.ActionClosePullRequest
skipping to change at line 72 skipping to change at line 72
actionType = models.ActionReopenPullRequest actionType = models.ActionReopenPullRequest
} }
} else { } else {
if isClosed { if isClosed {
actionType = models.ActionCloseIssue actionType = models.ActionCloseIssue
} else { } else {
actionType = models.ActionReopenIssue actionType = models.ActionReopenIssue
} }
} }
if err := mailer.MailParticipants(issue, doer, actionType); err != nil { if err := mailer.MailParticipants(issue, doer, actionType, nil); err != n il {
log.Error("MailParticipants: %v", err) log.Error("MailParticipants: %v", err)
} }
} }
func (m *mailNotifier) NotifyNewPullRequest(pr *models.PullRequest) { func (m *mailNotifier) NotifyNewPullRequest(pr *models.PullRequest, mentions []*
if err := mailer.MailParticipants(pr.Issue, pr.Issue.Poster, models.Actio models.User) {
nCreatePullRequest); err != nil { if err := mailer.MailParticipants(pr.Issue, pr.Issue.Poster, models.Actio
nCreatePullRequest, mentions); err != nil {
log.Error("MailParticipants: %v", err) log.Error("MailParticipants: %v", err)
} }
} }
func (m *mailNotifier) NotifyPullRequestReview(pr *models.PullRequest, r *models .Review, comment *models.Comment) { func (m *mailNotifier) NotifyPullRequestReview(pr *models.PullRequest, r *models .Review, comment *models.Comment, mentions []*models.User) {
var act models.ActionType var act models.ActionType
if comment.Type == models.CommentTypeClose { if comment.Type == models.CommentTypeClose {
act = models.ActionCloseIssue act = models.ActionCloseIssue
} else if comment.Type == models.CommentTypeReopen { } else if comment.Type == models.CommentTypeReopen {
act = models.ActionReopenIssue act = models.ActionReopenIssue
} else if comment.Type == models.CommentTypeComment { } else if comment.Type == models.CommentTypeComment {
act = models.ActionCommentPull act = models.ActionCommentPull
} }
if err := mailer.MailParticipantsComment(comment, act, pr.Issue); err != nil { if err := mailer.MailParticipantsComment(comment, act, pr.Issue, mentions ); err != nil {
log.Error("MailParticipantsComment: %v", err) log.Error("MailParticipantsComment: %v", err)
} }
} }
func (m *mailNotifier) NotifyPullRequestCodeComment(pr *models.PullRequest, comm
ent *models.Comment, mentions []*models.User) {
if err := mailer.MailMentionsComment(pr, comment, mentions); err != nil {
log.Error("MailMentionsComment: %v", err)
}
}
func (m *mailNotifier) NotifyIssueChangeAssignee(doer *models.User, issue *model s.Issue, assignee *models.User, removed bool, comment *models.Comment) { func (m *mailNotifier) NotifyIssueChangeAssignee(doer *models.User, issue *model s.Issue, assignee *models.User, removed bool, comment *models.Comment) {
// mail only sent to added assignees and not self-assignee // mail only sent to added assignees and not self-assignee
if !removed && doer.ID != assignee.ID && assignee.EmailNotifications() == models.EmailNotificationsEnabled { if !removed && doer.ID != assignee.ID && assignee.EmailNotifications() == models.EmailNotificationsEnabled {
ct := fmt.Sprintf("Assigned #%d.", issue.Index) ct := fmt.Sprintf("Assigned #%d.", issue.Index)
mailer.SendIssueAssignedMail(issue, doer, ct, comment, []string{a ssignee.Email}) mailer.SendIssueAssignedMail(issue, doer, ct, comment, []string{a ssignee.Email})
} }
} }
func (m *mailNotifier) NotifyPullReviewRequest(doer *models.User, issue *models. Issue, reviewer *models.User, isRequest bool, comment *models.Comment) { func (m *mailNotifier) NotifyPullReviewRequest(doer *models.User, issue *models. Issue, reviewer *models.User, isRequest bool, comment *models.Comment) {
if isRequest && doer.ID != reviewer.ID && reviewer.EmailNotifications() = = models.EmailNotificationsEnabled { if isRequest && doer.ID != reviewer.ID && reviewer.EmailNotifications() = = models.EmailNotificationsEnabled {
skipping to change at line 118 skipping to change at line 124
mailer.SendIssueAssignedMail(issue, doer, ct, comment, []string{r eviewer.Email}) mailer.SendIssueAssignedMail(issue, doer, ct, comment, []string{r eviewer.Email})
} }
} }
func (m *mailNotifier) NotifyMergePullRequest(pr *models.PullRequest, doer *mode ls.User) { func (m *mailNotifier) NotifyMergePullRequest(pr *models.PullRequest, doer *mode ls.User) {
if err := pr.LoadIssue(); err != nil { if err := pr.LoadIssue(); err != nil {
log.Error("pr.LoadIssue: %v", err) log.Error("pr.LoadIssue: %v", err)
return return
} }
pr.Issue.Content = "" pr.Issue.Content = ""
if err := mailer.MailParticipants(pr.Issue, doer, models.ActionMergePullR equest); err != nil { if err := mailer.MailParticipants(pr.Issue, doer, models.ActionMergePullR equest, nil); err != nil {
log.Error("MailParticipants: %v", err) log.Error("MailParticipants: %v", err)
} }
} }
func (m *mailNotifier) NotifyPullRequestPushCommits(doer *models.User, pr *model s.PullRequest, comment *models.Comment) { func (m *mailNotifier) NotifyPullRequestPushCommits(doer *models.User, pr *model s.PullRequest, comment *models.Comment) {
var err error var err error
if err = comment.LoadIssue(); err != nil { if err = comment.LoadIssue(); err != nil {
log.Error("comment.LoadIssue: %v", err) log.Error("comment.LoadIssue: %v", err)
return return
} }
skipping to change at line 146 skipping to change at line 152
} }
if err = comment.Issue.PullRequest.LoadBaseRepo(); err != nil { if err = comment.Issue.PullRequest.LoadBaseRepo(); err != nil {
log.Error("comment.Issue.PullRequest.LoadBaseRepo: %v", err) log.Error("comment.Issue.PullRequest.LoadBaseRepo: %v", err)
return return
} }
if err := comment.LoadPushCommits(); err != nil { if err := comment.LoadPushCommits(); err != nil {
log.Error("comment.LoadPushCommits: %v", err) log.Error("comment.LoadPushCommits: %v", err)
} }
comment.Content = "" comment.Content = ""
m.NotifyCreateIssueComment(doer, comment.Issue.Repo, comment.Issue, comme nt) m.NotifyCreateIssueComment(doer, comment.Issue.Repo, comment.Issue, comme nt, nil)
} }
func (m *mailNotifier) NotifyNewRelease(rel *models.Release) { func (m *mailNotifier) NotifyNewRelease(rel *models.Release) {
if err := rel.LoadAttributes(); err != nil { if err := rel.LoadAttributes(); err != nil {
log.Error("NotifyNewRelease: %v", err) log.Error("NotifyNewRelease: %v", err)
return return
} }
if rel.IsDraft || rel.IsPrerelease { if rel.IsDraft || rel.IsPrerelease {
return return
 End of changes. 10 change blocks. 
13 lines changed or deleted 22 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)