9a5720e8ad
Universal: PR Check / Branch Policy (pull_request) Successful in 1s
Branch Policy Check / Verify merge target (pull_request) Successful in 1s
PR RC Release / Build RC Release (pull_request) Successful in 3s
Universal: PR Check / Validate PR (pull_request) Failing after 6s
Branch Cleanup / Delete merged branch (pull_request) Successful in 1s
Universal: PR Check / Build RC Package (pull_request) Has been cancelled
Full namespace migration: update the Go module path and all import statements from git.mokoconsulting.tech to code.mokoconsulting.tech. Also updates all URL references in templates, workflows, configs, tests, and documentation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
62 lines
1.9 KiB
Go
62 lines
1.9 KiB
Go
// Copyright 2019 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package mailer
|
|
|
|
import (
|
|
"context"
|
|
|
|
activities_model "code.mokoconsulting.tech/MokoConsulting/MokoGitea/models/activities"
|
|
issues_model "code.mokoconsulting.tech/MokoConsulting/MokoGitea/models/issues"
|
|
user_model "code.mokoconsulting.tech/MokoConsulting/MokoGitea/models/user"
|
|
"code.mokoconsulting.tech/MokoConsulting/MokoGitea/modules/container"
|
|
"code.mokoconsulting.tech/MokoConsulting/MokoGitea/modules/log"
|
|
"code.mokoconsulting.tech/MokoConsulting/MokoGitea/modules/setting"
|
|
)
|
|
|
|
// MailParticipantsComment sends new comment emails to repository watchers and mentioned people.
|
|
func MailParticipantsComment(ctx context.Context, c *issues_model.Comment, opType activities_model.ActionType, issue *issues_model.Issue, mentions []*user_model.User) error {
|
|
if setting.MailService == nil {
|
|
// No mail service configured
|
|
return nil
|
|
}
|
|
|
|
content := c.Content
|
|
if c.Type == issues_model.CommentTypePullRequestPush {
|
|
content = ""
|
|
}
|
|
if err := mailIssueCommentToParticipants(ctx,
|
|
&mailComment{
|
|
Issue: issue,
|
|
Doer: c.Poster,
|
|
ActionType: opType,
|
|
Content: content,
|
|
Comment: c,
|
|
}, mentions); err != nil {
|
|
log.Error("mailIssueCommentToParticipants: %v", err)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// MailMentionsComment sends email to users mentioned in a code comment
|
|
func MailMentionsComment(ctx context.Context, pr *issues_model.PullRequest, c *issues_model.Comment, mentions []*user_model.User) (err error) {
|
|
if setting.MailService == nil {
|
|
// No mail service configured
|
|
return nil
|
|
}
|
|
|
|
visited := make(container.Set[int64], len(mentions)+1)
|
|
visited.Add(c.Poster.ID)
|
|
if err = mailIssueCommentBatch(ctx,
|
|
&mailComment{
|
|
Issue: pr.Issue,
|
|
Doer: c.Poster,
|
|
ActionType: activities_model.ActionCommentPull,
|
|
Content: c.Content,
|
|
Comment: c,
|
|
}, mentions, visited, true); err != nil {
|
|
log.Error("mailIssueCommentBatch: %v", err)
|
|
}
|
|
return nil
|
|
}
|