mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	Move issues related files into models/issues (#19931)
* Move access and repo permission to models/perm/access * fix test * fix git test * Move functions sequence * Some improvements per @KN4CK3R and @delvh * Move issues related code to models/issues * Move some issues related sub package * Merge * Fix test * Fix test * Fix test * Fix test * Rename some files
This commit is contained in:
		@@ -11,6 +11,7 @@ import (
 | 
			
		||||
 | 
			
		||||
	"code.gitea.io/gitea/models"
 | 
			
		||||
	"code.gitea.io/gitea/models/db"
 | 
			
		||||
	issues_model "code.gitea.io/gitea/models/issues"
 | 
			
		||||
	repo_model "code.gitea.io/gitea/models/repo"
 | 
			
		||||
	user_model "code.gitea.io/gitea/models/user"
 | 
			
		||||
	"code.gitea.io/gitea/modules/graceful"
 | 
			
		||||
@@ -33,7 +34,7 @@ func NewNotifier() base.Notifier {
 | 
			
		||||
	return &actionNotifier{}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (a *actionNotifier) NotifyNewIssue(issue *models.Issue, mentions []*user_model.User) {
 | 
			
		||||
func (a *actionNotifier) NotifyNewIssue(issue *issues_model.Issue, mentions []*user_model.User) {
 | 
			
		||||
	if err := issue.LoadPoster(); err != nil {
 | 
			
		||||
		log.Error("issue.LoadPoster: %v", err)
 | 
			
		||||
		return
 | 
			
		||||
@@ -58,7 +59,7 @@ func (a *actionNotifier) NotifyNewIssue(issue *models.Issue, mentions []*user_mo
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NotifyIssueChangeStatus notifies close or reopen issue to notifiers
 | 
			
		||||
func (a *actionNotifier) NotifyIssueChangeStatus(doer *user_model.User, issue *models.Issue, actionComment *models.Comment, closeOrReopen bool) {
 | 
			
		||||
func (a *actionNotifier) NotifyIssueChangeStatus(doer *user_model.User, issue *issues_model.Issue, actionComment *issues_model.Comment, closeOrReopen bool) {
 | 
			
		||||
	// Compose comment action, could be plain comment, close or reopen issue/pull request.
 | 
			
		||||
	// This object will be used to notify watchers in the end of function.
 | 
			
		||||
	act := &models.Action{
 | 
			
		||||
@@ -92,7 +93,7 @@ func (a *actionNotifier) NotifyIssueChangeStatus(doer *user_model.User, issue *m
 | 
			
		||||
 | 
			
		||||
// NotifyCreateIssueComment notifies comment on an issue to notifiers
 | 
			
		||||
func (a *actionNotifier) NotifyCreateIssueComment(doer *user_model.User, repo *repo_model.Repository,
 | 
			
		||||
	issue *models.Issue, comment *models.Comment, mentions []*user_model.User,
 | 
			
		||||
	issue *issues_model.Issue, comment *issues_model.Comment, mentions []*user_model.User,
 | 
			
		||||
) {
 | 
			
		||||
	act := &models.Action{
 | 
			
		||||
		ActUserID: doer.ID,
 | 
			
		||||
@@ -126,7 +127,7 @@ func (a *actionNotifier) NotifyCreateIssueComment(doer *user_model.User, repo *r
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (a *actionNotifier) NotifyNewPullRequest(pull *models.PullRequest, mentions []*user_model.User) {
 | 
			
		||||
func (a *actionNotifier) NotifyNewPullRequest(pull *issues_model.PullRequest, mentions []*user_model.User) {
 | 
			
		||||
	if err := pull.LoadIssue(); err != nil {
 | 
			
		||||
		log.Error("pull.LoadIssue: %v", err)
 | 
			
		||||
		return
 | 
			
		||||
@@ -207,7 +208,7 @@ func (a *actionNotifier) NotifyForkRepository(doer *user_model.User, oldRepo, re
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (a *actionNotifier) NotifyPullRequestReview(pr *models.PullRequest, review *models.Review, comment *models.Comment, mentions []*user_model.User) {
 | 
			
		||||
func (a *actionNotifier) NotifyPullRequestReview(pr *issues_model.PullRequest, review *issues_model.Review, comment *issues_model.Comment, mentions []*user_model.User) {
 | 
			
		||||
	ctx, _, finished := process.GetManager().AddContext(graceful.GetManager().HammerContext(), fmt.Sprintf("actionNotifier.NotifyPullRequestReview Pull[%d] #%d in [%d]", pr.ID, pr.Index, pr.BaseRepoID))
 | 
			
		||||
	defer finished()
 | 
			
		||||
 | 
			
		||||
@@ -239,7 +240,7 @@ func (a *actionNotifier) NotifyPullRequestReview(pr *models.PullRequest, review
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if review.Type != models.ReviewTypeComment || strings.TrimSpace(comment.Content) != "" {
 | 
			
		||||
	if review.Type != issues_model.ReviewTypeComment || strings.TrimSpace(comment.Content) != "" {
 | 
			
		||||
		action := &models.Action{
 | 
			
		||||
			ActUserID: review.Reviewer.ID,
 | 
			
		||||
			ActUser:   review.Reviewer,
 | 
			
		||||
@@ -252,9 +253,9 @@ func (a *actionNotifier) NotifyPullRequestReview(pr *models.PullRequest, review
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		switch review.Type {
 | 
			
		||||
		case models.ReviewTypeApprove:
 | 
			
		||||
		case issues_model.ReviewTypeApprove:
 | 
			
		||||
			action.OpType = models.ActionApprovePullRequest
 | 
			
		||||
		case models.ReviewTypeReject:
 | 
			
		||||
		case issues_model.ReviewTypeReject:
 | 
			
		||||
			action.OpType = models.ActionRejectPullRequest
 | 
			
		||||
		default:
 | 
			
		||||
			action.OpType = models.ActionCommentPull
 | 
			
		||||
@@ -268,7 +269,7 @@ func (a *actionNotifier) NotifyPullRequestReview(pr *models.PullRequest, review
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (*actionNotifier) NotifyMergePullRequest(pr *models.PullRequest, doer *user_model.User) {
 | 
			
		||||
func (*actionNotifier) NotifyMergePullRequest(pr *issues_model.PullRequest, doer *user_model.User) {
 | 
			
		||||
	if err := models.NotifyWatchers(&models.Action{
 | 
			
		||||
		ActUserID: doer.ID,
 | 
			
		||||
		ActUser:   doer,
 | 
			
		||||
@@ -282,7 +283,7 @@ func (*actionNotifier) NotifyMergePullRequest(pr *models.PullRequest, doer *user
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (*actionNotifier) NotifyPullRevieweDismiss(doer *user_model.User, review *models.Review, comment *models.Comment) {
 | 
			
		||||
func (*actionNotifier) NotifyPullRevieweDismiss(doer *user_model.User, review *issues_model.Review, comment *issues_model.Comment) {
 | 
			
		||||
	reviewerName := review.Reviewer.Name
 | 
			
		||||
	if len(review.OriginalAuthor) > 0 {
 | 
			
		||||
		reviewerName = review.OriginalAuthor
 | 
			
		||||
 
 | 
			
		||||
@@ -6,6 +6,7 @@ package base
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"code.gitea.io/gitea/models"
 | 
			
		||||
	issues_model "code.gitea.io/gitea/models/issues"
 | 
			
		||||
	packages_model "code.gitea.io/gitea/models/packages"
 | 
			
		||||
	repo_model "code.gitea.io/gitea/models/repo"
 | 
			
		||||
	user_model "code.gitea.io/gitea/models/user"
 | 
			
		||||
@@ -21,30 +22,30 @@ type Notifier interface {
 | 
			
		||||
	NotifyForkRepository(doer *user_model.User, oldRepo, repo *repo_model.Repository)
 | 
			
		||||
	NotifyRenameRepository(doer *user_model.User, repo *repo_model.Repository, oldRepoName string)
 | 
			
		||||
	NotifyTransferRepository(doer *user_model.User, repo *repo_model.Repository, oldOwnerName string)
 | 
			
		||||
	NotifyNewIssue(issue *models.Issue, mentions []*user_model.User)
 | 
			
		||||
	NotifyIssueChangeStatus(*user_model.User, *models.Issue, *models.Comment, bool)
 | 
			
		||||
	NotifyDeleteIssue(*user_model.User, *models.Issue)
 | 
			
		||||
	NotifyIssueChangeMilestone(doer *user_model.User, issue *models.Issue, oldMilestoneID int64)
 | 
			
		||||
	NotifyIssueChangeAssignee(doer *user_model.User, issue *models.Issue, assignee *user_model.User, removed bool, comment *models.Comment)
 | 
			
		||||
	NotifyPullReviewRequest(doer *user_model.User, issue *models.Issue, reviewer *user_model.User, isRequest bool, comment *models.Comment)
 | 
			
		||||
	NotifyIssueChangeContent(doer *user_model.User, issue *models.Issue, oldContent string)
 | 
			
		||||
	NotifyIssueClearLabels(doer *user_model.User, issue *models.Issue)
 | 
			
		||||
	NotifyIssueChangeTitle(doer *user_model.User, issue *models.Issue, oldTitle string)
 | 
			
		||||
	NotifyIssueChangeRef(doer *user_model.User, issue *models.Issue, oldRef string)
 | 
			
		||||
	NotifyIssueChangeLabels(doer *user_model.User, issue *models.Issue,
 | 
			
		||||
		addedLabels, removedLabels []*models.Label)
 | 
			
		||||
	NotifyNewPullRequest(pr *models.PullRequest, mentions []*user_model.User)
 | 
			
		||||
	NotifyMergePullRequest(*models.PullRequest, *user_model.User)
 | 
			
		||||
	NotifyPullRequestSynchronized(doer *user_model.User, pr *models.PullRequest)
 | 
			
		||||
	NotifyPullRequestReview(pr *models.PullRequest, review *models.Review, comment *models.Comment, mentions []*user_model.User)
 | 
			
		||||
	NotifyPullRequestCodeComment(pr *models.PullRequest, comment *models.Comment, mentions []*user_model.User)
 | 
			
		||||
	NotifyPullRequestChangeTargetBranch(doer *user_model.User, pr *models.PullRequest, oldBranch string)
 | 
			
		||||
	NotifyPullRequestPushCommits(doer *user_model.User, pr *models.PullRequest, comment *models.Comment)
 | 
			
		||||
	NotifyPullRevieweDismiss(doer *user_model.User, review *models.Review, comment *models.Comment)
 | 
			
		||||
	NotifyNewIssue(issue *issues_model.Issue, mentions []*user_model.User)
 | 
			
		||||
	NotifyIssueChangeStatus(*user_model.User, *issues_model.Issue, *issues_model.Comment, bool)
 | 
			
		||||
	NotifyDeleteIssue(*user_model.User, *issues_model.Issue)
 | 
			
		||||
	NotifyIssueChangeMilestone(doer *user_model.User, issue *issues_model.Issue, oldMilestoneID int64)
 | 
			
		||||
	NotifyIssueChangeAssignee(doer *user_model.User, issue *issues_model.Issue, assignee *user_model.User, removed bool, comment *issues_model.Comment)
 | 
			
		||||
	NotifyPullReviewRequest(doer *user_model.User, issue *issues_model.Issue, reviewer *user_model.User, isRequest bool, comment *issues_model.Comment)
 | 
			
		||||
	NotifyIssueChangeContent(doer *user_model.User, issue *issues_model.Issue, oldContent string)
 | 
			
		||||
	NotifyIssueClearLabels(doer *user_model.User, issue *issues_model.Issue)
 | 
			
		||||
	NotifyIssueChangeTitle(doer *user_model.User, issue *issues_model.Issue, oldTitle string)
 | 
			
		||||
	NotifyIssueChangeRef(doer *user_model.User, issue *issues_model.Issue, oldRef string)
 | 
			
		||||
	NotifyIssueChangeLabels(doer *user_model.User, issue *issues_model.Issue,
 | 
			
		||||
		addedLabels, removedLabels []*issues_model.Label)
 | 
			
		||||
	NotifyNewPullRequest(pr *issues_model.PullRequest, mentions []*user_model.User)
 | 
			
		||||
	NotifyMergePullRequest(*issues_model.PullRequest, *user_model.User)
 | 
			
		||||
	NotifyPullRequestSynchronized(doer *user_model.User, pr *issues_model.PullRequest)
 | 
			
		||||
	NotifyPullRequestReview(pr *issues_model.PullRequest, review *issues_model.Review, comment *issues_model.Comment, mentions []*user_model.User)
 | 
			
		||||
	NotifyPullRequestCodeComment(pr *issues_model.PullRequest, comment *issues_model.Comment, mentions []*user_model.User)
 | 
			
		||||
	NotifyPullRequestChangeTargetBranch(doer *user_model.User, pr *issues_model.PullRequest, oldBranch string)
 | 
			
		||||
	NotifyPullRequestPushCommits(doer *user_model.User, pr *issues_model.PullRequest, comment *issues_model.Comment)
 | 
			
		||||
	NotifyPullRevieweDismiss(doer *user_model.User, review *issues_model.Review, comment *issues_model.Comment)
 | 
			
		||||
	NotifyCreateIssueComment(doer *user_model.User, repo *repo_model.Repository,
 | 
			
		||||
		issue *models.Issue, comment *models.Comment, mentions []*user_model.User)
 | 
			
		||||
	NotifyUpdateComment(*user_model.User, *models.Comment, string)
 | 
			
		||||
	NotifyDeleteComment(*user_model.User, *models.Comment)
 | 
			
		||||
		issue *issues_model.Issue, comment *issues_model.Comment, mentions []*user_model.User)
 | 
			
		||||
	NotifyUpdateComment(*user_model.User, *issues_model.Comment, string)
 | 
			
		||||
	NotifyDeleteComment(*user_model.User, *issues_model.Comment)
 | 
			
		||||
	NotifyNewRelease(rel *models.Release)
 | 
			
		||||
	NotifyUpdateRelease(doer *user_model.User, rel *models.Release)
 | 
			
		||||
	NotifyDeleteRelease(doer *user_model.User, rel *models.Release)
 | 
			
		||||
 
 | 
			
		||||
@@ -6,6 +6,7 @@ package base
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"code.gitea.io/gitea/models"
 | 
			
		||||
	issues_model "code.gitea.io/gitea/models/issues"
 | 
			
		||||
	packages_model "code.gitea.io/gitea/models/packages"
 | 
			
		||||
	repo_model "code.gitea.io/gitea/models/repo"
 | 
			
		||||
	user_model "code.gitea.io/gitea/models/user"
 | 
			
		||||
@@ -23,59 +24,59 @@ func (*NullNotifier) Run() {
 | 
			
		||||
 | 
			
		||||
// NotifyCreateIssueComment places a place holder function
 | 
			
		||||
func (*NullNotifier) NotifyCreateIssueComment(doer *user_model.User, repo *repo_model.Repository,
 | 
			
		||||
	issue *models.Issue, comment *models.Comment, mentions []*user_model.User) {
 | 
			
		||||
	issue *issues_model.Issue, comment *issues_model.Comment, mentions []*user_model.User) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NotifyNewIssue places a place holder function
 | 
			
		||||
func (*NullNotifier) NotifyNewIssue(issue *models.Issue, mentions []*user_model.User) {
 | 
			
		||||
func (*NullNotifier) NotifyNewIssue(issue *issues_model.Issue, mentions []*user_model.User) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NotifyIssueChangeStatus places a place holder function
 | 
			
		||||
func (*NullNotifier) NotifyIssueChangeStatus(doer *user_model.User, issue *models.Issue, actionComment *models.Comment, isClosed bool) {
 | 
			
		||||
func (*NullNotifier) NotifyIssueChangeStatus(doer *user_model.User, issue *issues_model.Issue, actionComment *issues_model.Comment, isClosed bool) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NotifyDeleteIssue notify when some issue deleted
 | 
			
		||||
func (*NullNotifier) NotifyDeleteIssue(doer *user_model.User, issue *models.Issue) {
 | 
			
		||||
func (*NullNotifier) NotifyDeleteIssue(doer *user_model.User, issue *issues_model.Issue) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NotifyNewPullRequest places a place holder function
 | 
			
		||||
func (*NullNotifier) NotifyNewPullRequest(pr *models.PullRequest, mentions []*user_model.User) {
 | 
			
		||||
func (*NullNotifier) NotifyNewPullRequest(pr *issues_model.PullRequest, mentions []*user_model.User) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NotifyPullRequestReview places a place holder function
 | 
			
		||||
func (*NullNotifier) NotifyPullRequestReview(pr *models.PullRequest, r *models.Review, comment *models.Comment, mentions []*user_model.User) {
 | 
			
		||||
func (*NullNotifier) NotifyPullRequestReview(pr *issues_model.PullRequest, r *issues_model.Review, comment *issues_model.Comment, mentions []*user_model.User) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NotifyPullRequestCodeComment places a place holder function
 | 
			
		||||
func (*NullNotifier) NotifyPullRequestCodeComment(pr *models.PullRequest, comment *models.Comment, mentions []*user_model.User) {
 | 
			
		||||
func (*NullNotifier) NotifyPullRequestCodeComment(pr *issues_model.PullRequest, comment *issues_model.Comment, mentions []*user_model.User) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NotifyMergePullRequest places a place holder function
 | 
			
		||||
func (*NullNotifier) NotifyMergePullRequest(pr *models.PullRequest, doer *user_model.User) {
 | 
			
		||||
func (*NullNotifier) NotifyMergePullRequest(pr *issues_model.PullRequest, doer *user_model.User) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NotifyPullRequestSynchronized places a place holder function
 | 
			
		||||
func (*NullNotifier) NotifyPullRequestSynchronized(doer *user_model.User, pr *models.PullRequest) {
 | 
			
		||||
func (*NullNotifier) NotifyPullRequestSynchronized(doer *user_model.User, pr *issues_model.PullRequest) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NotifyPullRequestChangeTargetBranch places a place holder function
 | 
			
		||||
func (*NullNotifier) NotifyPullRequestChangeTargetBranch(doer *user_model.User, pr *models.PullRequest, oldBranch string) {
 | 
			
		||||
func (*NullNotifier) NotifyPullRequestChangeTargetBranch(doer *user_model.User, pr *issues_model.PullRequest, oldBranch string) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NotifyPullRequestPushCommits notifies when push commits to pull request's head branch
 | 
			
		||||
func (*NullNotifier) NotifyPullRequestPushCommits(doer *user_model.User, pr *models.PullRequest, comment *models.Comment) {
 | 
			
		||||
func (*NullNotifier) NotifyPullRequestPushCommits(doer *user_model.User, pr *issues_model.PullRequest, comment *issues_model.Comment) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NotifyPullRevieweDismiss notifies when a review was dismissed by repo admin
 | 
			
		||||
func (*NullNotifier) NotifyPullRevieweDismiss(doer *user_model.User, review *models.Review, comment *models.Comment) {
 | 
			
		||||
func (*NullNotifier) NotifyPullRevieweDismiss(doer *user_model.User, review *issues_model.Review, comment *issues_model.Comment) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NotifyUpdateComment places a place holder function
 | 
			
		||||
func (*NullNotifier) NotifyUpdateComment(doer *user_model.User, c *models.Comment, oldContent string) {
 | 
			
		||||
func (*NullNotifier) NotifyUpdateComment(doer *user_model.User, c *issues_model.Comment, oldContent string) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NotifyDeleteComment places a place holder function
 | 
			
		||||
func (*NullNotifier) NotifyDeleteComment(doer *user_model.User, c *models.Comment) {
 | 
			
		||||
func (*NullNotifier) NotifyDeleteComment(doer *user_model.User, c *issues_model.Comment) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NotifyNewRelease places a place holder function
 | 
			
		||||
@@ -91,36 +92,36 @@ func (*NullNotifier) NotifyDeleteRelease(doer *user_model.User, rel *models.Rele
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NotifyIssueChangeMilestone places a place holder function
 | 
			
		||||
func (*NullNotifier) NotifyIssueChangeMilestone(doer *user_model.User, issue *models.Issue, oldMilestoneID int64) {
 | 
			
		||||
func (*NullNotifier) NotifyIssueChangeMilestone(doer *user_model.User, issue *issues_model.Issue, oldMilestoneID int64) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NotifyIssueChangeContent places a place holder function
 | 
			
		||||
func (*NullNotifier) NotifyIssueChangeContent(doer *user_model.User, issue *models.Issue, oldContent string) {
 | 
			
		||||
func (*NullNotifier) NotifyIssueChangeContent(doer *user_model.User, issue *issues_model.Issue, oldContent string) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NotifyIssueChangeAssignee places a place holder function
 | 
			
		||||
func (*NullNotifier) NotifyIssueChangeAssignee(doer *user_model.User, issue *models.Issue, assignee *user_model.User, removed bool, comment *models.Comment) {
 | 
			
		||||
func (*NullNotifier) NotifyIssueChangeAssignee(doer *user_model.User, issue *issues_model.Issue, assignee *user_model.User, removed bool, comment *issues_model.Comment) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NotifyPullReviewRequest places a place holder function
 | 
			
		||||
func (*NullNotifier) NotifyPullReviewRequest(doer *user_model.User, issue *models.Issue, reviewer *user_model.User, isRequest bool, comment *models.Comment) {
 | 
			
		||||
func (*NullNotifier) NotifyPullReviewRequest(doer *user_model.User, issue *issues_model.Issue, reviewer *user_model.User, isRequest bool, comment *issues_model.Comment) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NotifyIssueClearLabels places a place holder function
 | 
			
		||||
func (*NullNotifier) NotifyIssueClearLabels(doer *user_model.User, issue *models.Issue) {
 | 
			
		||||
func (*NullNotifier) NotifyIssueClearLabels(doer *user_model.User, issue *issues_model.Issue) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NotifyIssueChangeTitle places a place holder function
 | 
			
		||||
func (*NullNotifier) NotifyIssueChangeTitle(doer *user_model.User, issue *models.Issue, oldTitle string) {
 | 
			
		||||
func (*NullNotifier) NotifyIssueChangeTitle(doer *user_model.User, issue *issues_model.Issue, oldTitle string) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NotifyIssueChangeRef places a place holder function
 | 
			
		||||
func (*NullNotifier) NotifyIssueChangeRef(doer *user_model.User, issue *models.Issue, oldTitle string) {
 | 
			
		||||
func (*NullNotifier) NotifyIssueChangeRef(doer *user_model.User, issue *issues_model.Issue, oldTitle string) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NotifyIssueChangeLabels places a place holder function
 | 
			
		||||
func (*NullNotifier) NotifyIssueChangeLabels(doer *user_model.User, issue *models.Issue,
 | 
			
		||||
	addedLabels, removedLabels []*models.Label) {
 | 
			
		||||
func (*NullNotifier) NotifyIssueChangeLabels(doer *user_model.User, issue *issues_model.Issue,
 | 
			
		||||
	addedLabels, removedLabels []*issues_model.Label) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NotifyCreateRepository places a place holder function
 | 
			
		||||
 
 | 
			
		||||
@@ -5,7 +5,7 @@
 | 
			
		||||
package indexer
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"code.gitea.io/gitea/models"
 | 
			
		||||
	issues_model "code.gitea.io/gitea/models/issues"
 | 
			
		||||
	repo_model "code.gitea.io/gitea/models/repo"
 | 
			
		||||
	user_model "code.gitea.io/gitea/models/user"
 | 
			
		||||
	"code.gitea.io/gitea/modules/git"
 | 
			
		||||
@@ -30,9 +30,9 @@ func NewNotifier() base.Notifier {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (r *indexerNotifier) NotifyCreateIssueComment(doer *user_model.User, repo *repo_model.Repository,
 | 
			
		||||
	issue *models.Issue, comment *models.Comment, mentions []*user_model.User,
 | 
			
		||||
	issue *issues_model.Issue, comment *issues_model.Comment, mentions []*user_model.User,
 | 
			
		||||
) {
 | 
			
		||||
	if comment.Type == models.CommentTypeComment {
 | 
			
		||||
	if comment.Type == issues_model.CommentTypeComment {
 | 
			
		||||
		if issue.Comments == nil {
 | 
			
		||||
			if err := issue.LoadDiscussComments(); err != nil {
 | 
			
		||||
				log.Error("LoadComments failed: %v", err)
 | 
			
		||||
@@ -46,16 +46,16 @@ func (r *indexerNotifier) NotifyCreateIssueComment(doer *user_model.User, repo *
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (r *indexerNotifier) NotifyNewIssue(issue *models.Issue, mentions []*user_model.User) {
 | 
			
		||||
func (r *indexerNotifier) NotifyNewIssue(issue *issues_model.Issue, mentions []*user_model.User) {
 | 
			
		||||
	issue_indexer.UpdateIssueIndexer(issue)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (r *indexerNotifier) NotifyNewPullRequest(pr *models.PullRequest, mentions []*user_model.User) {
 | 
			
		||||
func (r *indexerNotifier) NotifyNewPullRequest(pr *issues_model.PullRequest, mentions []*user_model.User) {
 | 
			
		||||
	issue_indexer.UpdateIssueIndexer(pr.Issue)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (r *indexerNotifier) NotifyUpdateComment(doer *user_model.User, c *models.Comment, oldContent string) {
 | 
			
		||||
	if c.Type == models.CommentTypeComment {
 | 
			
		||||
func (r *indexerNotifier) NotifyUpdateComment(doer *user_model.User, c *issues_model.Comment, oldContent string) {
 | 
			
		||||
	if c.Type == issues_model.CommentTypeComment {
 | 
			
		||||
		var found bool
 | 
			
		||||
		if c.Issue.Comments != nil {
 | 
			
		||||
			for i := 0; i < len(c.Issue.Comments); i++ {
 | 
			
		||||
@@ -78,8 +78,8 @@ func (r *indexerNotifier) NotifyUpdateComment(doer *user_model.User, c *models.C
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (r *indexerNotifier) NotifyDeleteComment(doer *user_model.User, comment *models.Comment) {
 | 
			
		||||
	if comment.Type == models.CommentTypeComment {
 | 
			
		||||
func (r *indexerNotifier) NotifyDeleteComment(doer *user_model.User, comment *issues_model.Comment) {
 | 
			
		||||
	if comment.Type == issues_model.CommentTypeComment {
 | 
			
		||||
		if err := comment.LoadIssue(); err != nil {
 | 
			
		||||
			log.Error("LoadIssue: %v", err)
 | 
			
		||||
			return
 | 
			
		||||
@@ -142,14 +142,14 @@ func (r *indexerNotifier) NotifySyncPushCommits(pusher *user_model.User, repo *r
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (r *indexerNotifier) NotifyIssueChangeContent(doer *user_model.User, issue *models.Issue, oldContent string) {
 | 
			
		||||
func (r *indexerNotifier) NotifyIssueChangeContent(doer *user_model.User, issue *issues_model.Issue, oldContent string) {
 | 
			
		||||
	issue_indexer.UpdateIssueIndexer(issue)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (r *indexerNotifier) NotifyIssueChangeTitle(doer *user_model.User, issue *models.Issue, oldTitle string) {
 | 
			
		||||
func (r *indexerNotifier) NotifyIssueChangeTitle(doer *user_model.User, issue *issues_model.Issue, oldTitle string) {
 | 
			
		||||
	issue_indexer.UpdateIssueIndexer(issue)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (r *indexerNotifier) NotifyIssueChangeRef(doer *user_model.User, issue *models.Issue, oldRef string) {
 | 
			
		||||
func (r *indexerNotifier) NotifyIssueChangeRef(doer *user_model.User, issue *issues_model.Issue, oldRef string) {
 | 
			
		||||
	issue_indexer.UpdateIssueIndexer(issue)
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -8,6 +8,7 @@ import (
 | 
			
		||||
	"fmt"
 | 
			
		||||
 | 
			
		||||
	"code.gitea.io/gitea/models"
 | 
			
		||||
	issues_model "code.gitea.io/gitea/models/issues"
 | 
			
		||||
	repo_model "code.gitea.io/gitea/models/repo"
 | 
			
		||||
	user_model "code.gitea.io/gitea/models/user"
 | 
			
		||||
	"code.gitea.io/gitea/modules/graceful"
 | 
			
		||||
@@ -29,21 +30,21 @@ func NewNotifier() base.Notifier {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (m *mailNotifier) NotifyCreateIssueComment(doer *user_model.User, repo *repo_model.Repository,
 | 
			
		||||
	issue *models.Issue, comment *models.Comment, mentions []*user_model.User,
 | 
			
		||||
	issue *issues_model.Issue, comment *issues_model.Comment, mentions []*user_model.User,
 | 
			
		||||
) {
 | 
			
		||||
	ctx, _, finished := process.GetManager().AddContext(graceful.GetManager().HammerContext(), fmt.Sprintf("mailNotifier.NotifyCreateIssueComment Issue[%d] #%d in [%d]", issue.ID, issue.Index, issue.RepoID))
 | 
			
		||||
	defer finished()
 | 
			
		||||
 | 
			
		||||
	var act models.ActionType
 | 
			
		||||
	if comment.Type == models.CommentTypeClose {
 | 
			
		||||
	if comment.Type == issues_model.CommentTypeClose {
 | 
			
		||||
		act = models.ActionCloseIssue
 | 
			
		||||
	} else if comment.Type == models.CommentTypeReopen {
 | 
			
		||||
	} else if comment.Type == issues_model.CommentTypeReopen {
 | 
			
		||||
		act = models.ActionReopenIssue
 | 
			
		||||
	} else if comment.Type == models.CommentTypeComment {
 | 
			
		||||
	} else if comment.Type == issues_model.CommentTypeComment {
 | 
			
		||||
		act = models.ActionCommentIssue
 | 
			
		||||
	} else if comment.Type == models.CommentTypeCode {
 | 
			
		||||
	} else if comment.Type == issues_model.CommentTypeCode {
 | 
			
		||||
		act = models.ActionCommentIssue
 | 
			
		||||
	} else if comment.Type == models.CommentTypePullRequestPush {
 | 
			
		||||
	} else if comment.Type == issues_model.CommentTypePullRequestPush {
 | 
			
		||||
		act = 0
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -52,13 +53,13 @@ func (m *mailNotifier) NotifyCreateIssueComment(doer *user_model.User, repo *rep
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (m *mailNotifier) NotifyNewIssue(issue *models.Issue, mentions []*user_model.User) {
 | 
			
		||||
func (m *mailNotifier) NotifyNewIssue(issue *issues_model.Issue, mentions []*user_model.User) {
 | 
			
		||||
	if err := mailer.MailParticipants(issue, issue.Poster, models.ActionCreateIssue, mentions); err != nil {
 | 
			
		||||
		log.Error("MailParticipants: %v", err)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (m *mailNotifier) NotifyIssueChangeStatus(doer *user_model.User, issue *models.Issue, actionComment *models.Comment, isClosed bool) {
 | 
			
		||||
func (m *mailNotifier) NotifyIssueChangeStatus(doer *user_model.User, issue *issues_model.Issue, actionComment *issues_model.Comment, isClosed bool) {
 | 
			
		||||
	var actionType models.ActionType
 | 
			
		||||
	if issue.IsPull {
 | 
			
		||||
		if isClosed {
 | 
			
		||||
@@ -79,34 +80,34 @@ func (m *mailNotifier) NotifyIssueChangeStatus(doer *user_model.User, issue *mod
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (m *mailNotifier) NotifyIssueChangeTitle(doer *user_model.User, issue *models.Issue, oldTitle string) {
 | 
			
		||||
func (m *mailNotifier) NotifyIssueChangeTitle(doer *user_model.User, issue *issues_model.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 issue.IsPull && issues_model.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 []*user_model.User) {
 | 
			
		||||
func (m *mailNotifier) NotifyNewPullRequest(pr *issues_model.PullRequest, mentions []*user_model.User) {
 | 
			
		||||
	if err := mailer.MailParticipants(pr.Issue, pr.Issue.Poster, models.ActionCreatePullRequest, mentions); err != nil {
 | 
			
		||||
		log.Error("MailParticipants: %v", err)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (m *mailNotifier) NotifyPullRequestReview(pr *models.PullRequest, r *models.Review, comment *models.Comment, mentions []*user_model.User) {
 | 
			
		||||
func (m *mailNotifier) NotifyPullRequestReview(pr *issues_model.PullRequest, r *issues_model.Review, comment *issues_model.Comment, mentions []*user_model.User) {
 | 
			
		||||
	ctx, _, finished := process.GetManager().AddContext(graceful.GetManager().HammerContext(), fmt.Sprintf("mailNotifier.NotifyPullRequestReview Pull[%d] #%d in [%d]", pr.ID, pr.Index, pr.BaseRepoID))
 | 
			
		||||
	defer finished()
 | 
			
		||||
 | 
			
		||||
	var act models.ActionType
 | 
			
		||||
	if comment.Type == models.CommentTypeClose {
 | 
			
		||||
	if comment.Type == issues_model.CommentTypeClose {
 | 
			
		||||
		act = models.ActionCloseIssue
 | 
			
		||||
	} else if comment.Type == models.CommentTypeReopen {
 | 
			
		||||
	} else if comment.Type == issues_model.CommentTypeReopen {
 | 
			
		||||
		act = models.ActionReopenIssue
 | 
			
		||||
	} else if comment.Type == models.CommentTypeComment {
 | 
			
		||||
	} else if comment.Type == issues_model.CommentTypeComment {
 | 
			
		||||
		act = models.ActionCommentPull
 | 
			
		||||
	}
 | 
			
		||||
	if err := mailer.MailParticipantsComment(ctx, comment, act, pr.Issue, mentions); err != nil {
 | 
			
		||||
@@ -114,7 +115,7 @@ func (m *mailNotifier) NotifyPullRequestReview(pr *models.PullRequest, r *models
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (m *mailNotifier) NotifyPullRequestCodeComment(pr *models.PullRequest, comment *models.Comment, mentions []*user_model.User) {
 | 
			
		||||
func (m *mailNotifier) NotifyPullRequestCodeComment(pr *issues_model.PullRequest, comment *issues_model.Comment, mentions []*user_model.User) {
 | 
			
		||||
	ctx, _, finished := process.GetManager().AddContext(graceful.GetManager().HammerContext(), fmt.Sprintf("mailNotifier.NotifyPullRequestCodeComment Pull[%d] #%d in [%d]", pr.ID, pr.Index, pr.BaseRepoID))
 | 
			
		||||
	defer finished()
 | 
			
		||||
 | 
			
		||||
@@ -123,7 +124,7 @@ func (m *mailNotifier) NotifyPullRequestCodeComment(pr *models.PullRequest, comm
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (m *mailNotifier) NotifyIssueChangeAssignee(doer *user_model.User, issue *models.Issue, assignee *user_model.User, removed bool, comment *models.Comment) {
 | 
			
		||||
func (m *mailNotifier) NotifyIssueChangeAssignee(doer *user_model.User, issue *issues_model.Issue, assignee *user_model.User, removed bool, comment *issues_model.Comment) {
 | 
			
		||||
	// mail only sent to added assignees and not self-assignee
 | 
			
		||||
	if !removed && doer.ID != assignee.ID && (assignee.EmailNotifications() == user_model.EmailNotificationsEnabled || assignee.EmailNotifications() == user_model.EmailNotificationsOnMention) {
 | 
			
		||||
		ct := fmt.Sprintf("Assigned #%d.", issue.Index)
 | 
			
		||||
@@ -133,7 +134,7 @@ func (m *mailNotifier) NotifyIssueChangeAssignee(doer *user_model.User, issue *m
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (m *mailNotifier) NotifyPullReviewRequest(doer *user_model.User, issue *models.Issue, reviewer *user_model.User, isRequest bool, comment *models.Comment) {
 | 
			
		||||
func (m *mailNotifier) NotifyPullReviewRequest(doer *user_model.User, issue *issues_model.Issue, reviewer *user_model.User, isRequest bool, comment *issues_model.Comment) {
 | 
			
		||||
	if isRequest && doer.ID != reviewer.ID && (reviewer.EmailNotifications() == user_model.EmailNotificationsEnabled || reviewer.EmailNotifications() == user_model.EmailNotificationsOnMention) {
 | 
			
		||||
		ct := fmt.Sprintf("Requested to review %s.", issue.HTMLURL())
 | 
			
		||||
		if err := mailer.SendIssueAssignedMail(issue, doer, ct, comment, []*user_model.User{reviewer}); err != nil {
 | 
			
		||||
@@ -142,7 +143,7 @@ func (m *mailNotifier) NotifyPullReviewRequest(doer *user_model.User, issue *mod
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (m *mailNotifier) NotifyMergePullRequest(pr *models.PullRequest, doer *user_model.User) {
 | 
			
		||||
func (m *mailNotifier) NotifyMergePullRequest(pr *issues_model.PullRequest, doer *user_model.User) {
 | 
			
		||||
	if err := pr.LoadIssue(); err != nil {
 | 
			
		||||
		log.Error("pr.LoadIssue: %v", err)
 | 
			
		||||
		return
 | 
			
		||||
@@ -152,7 +153,7 @@ func (m *mailNotifier) NotifyMergePullRequest(pr *models.PullRequest, doer *user
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (m *mailNotifier) NotifyPullRequestPushCommits(doer *user_model.User, pr *models.PullRequest, comment *models.Comment) {
 | 
			
		||||
func (m *mailNotifier) NotifyPullRequestPushCommits(doer *user_model.User, pr *issues_model.PullRequest, comment *issues_model.Comment) {
 | 
			
		||||
	ctx, _, finished := process.GetManager().AddContext(graceful.GetManager().HammerContext(), fmt.Sprintf("mailNotifier.NotifyPullRequestPushCommits Pull[%d] #%d in [%d]", pr.ID, pr.Index, pr.BaseRepoID))
 | 
			
		||||
	defer finished()
 | 
			
		||||
 | 
			
		||||
@@ -179,7 +180,7 @@ func (m *mailNotifier) NotifyPullRequestPushCommits(doer *user_model.User, pr *m
 | 
			
		||||
	m.NotifyCreateIssueComment(doer, comment.Issue.Repo, comment.Issue, comment, nil)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (m *mailNotifier) NotifyPullRevieweDismiss(doer *user_model.User, review *models.Review, comment *models.Comment) {
 | 
			
		||||
func (m *mailNotifier) NotifyPullRevieweDismiss(doer *user_model.User, review *issues_model.Review, comment *issues_model.Comment) {
 | 
			
		||||
	ctx, _, finished := process.GetManager().AddContext(graceful.GetManager().HammerContext(), fmt.Sprintf("mailNotifier.NotifyPullRevieweDismiss Review[%d] in Issue[%d]", review.ID, review.IssueID))
 | 
			
		||||
	defer finished()
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -6,6 +6,7 @@ package notification
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"code.gitea.io/gitea/models"
 | 
			
		||||
	issues_model "code.gitea.io/gitea/models/issues"
 | 
			
		||||
	packages_model "code.gitea.io/gitea/models/packages"
 | 
			
		||||
	repo_model "code.gitea.io/gitea/models/repo"
 | 
			
		||||
	user_model "code.gitea.io/gitea/models/user"
 | 
			
		||||
@@ -40,7 +41,7 @@ func NewContext() {
 | 
			
		||||
 | 
			
		||||
// NotifyCreateIssueComment notifies issue comment related message to notifiers
 | 
			
		||||
func NotifyCreateIssueComment(doer *user_model.User, repo *repo_model.Repository,
 | 
			
		||||
	issue *models.Issue, comment *models.Comment, mentions []*user_model.User,
 | 
			
		||||
	issue *issues_model.Issue, comment *issues_model.Comment, mentions []*user_model.User,
 | 
			
		||||
) {
 | 
			
		||||
	for _, notifier := range notifiers {
 | 
			
		||||
		notifier.NotifyCreateIssueComment(doer, repo, issue, comment, mentions)
 | 
			
		||||
@@ -48,91 +49,91 @@ func NotifyCreateIssueComment(doer *user_model.User, repo *repo_model.Repository
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NotifyNewIssue notifies new issue to notifiers
 | 
			
		||||
func NotifyNewIssue(issue *models.Issue, mentions []*user_model.User) {
 | 
			
		||||
func NotifyNewIssue(issue *issues_model.Issue, mentions []*user_model.User) {
 | 
			
		||||
	for _, notifier := range notifiers {
 | 
			
		||||
		notifier.NotifyNewIssue(issue, mentions)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NotifyIssueChangeStatus notifies close or reopen issue to notifiers
 | 
			
		||||
func NotifyIssueChangeStatus(doer *user_model.User, issue *models.Issue, actionComment *models.Comment, closeOrReopen bool) {
 | 
			
		||||
func NotifyIssueChangeStatus(doer *user_model.User, issue *issues_model.Issue, actionComment *issues_model.Comment, closeOrReopen bool) {
 | 
			
		||||
	for _, notifier := range notifiers {
 | 
			
		||||
		notifier.NotifyIssueChangeStatus(doer, issue, actionComment, closeOrReopen)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NotifyDeleteIssue notify when some issue deleted
 | 
			
		||||
func NotifyDeleteIssue(doer *user_model.User, issue *models.Issue) {
 | 
			
		||||
func NotifyDeleteIssue(doer *user_model.User, issue *issues_model.Issue) {
 | 
			
		||||
	for _, notifier := range notifiers {
 | 
			
		||||
		notifier.NotifyDeleteIssue(doer, issue)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NotifyMergePullRequest notifies merge pull request to notifiers
 | 
			
		||||
func NotifyMergePullRequest(pr *models.PullRequest, doer *user_model.User) {
 | 
			
		||||
func NotifyMergePullRequest(pr *issues_model.PullRequest, doer *user_model.User) {
 | 
			
		||||
	for _, notifier := range notifiers {
 | 
			
		||||
		notifier.NotifyMergePullRequest(pr, doer)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NotifyNewPullRequest notifies new pull request to notifiers
 | 
			
		||||
func NotifyNewPullRequest(pr *models.PullRequest, mentions []*user_model.User) {
 | 
			
		||||
func NotifyNewPullRequest(pr *issues_model.PullRequest, mentions []*user_model.User) {
 | 
			
		||||
	for _, notifier := range notifiers {
 | 
			
		||||
		notifier.NotifyNewPullRequest(pr, mentions)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NotifyPullRequestSynchronized notifies Synchronized pull request
 | 
			
		||||
func NotifyPullRequestSynchronized(doer *user_model.User, pr *models.PullRequest) {
 | 
			
		||||
func NotifyPullRequestSynchronized(doer *user_model.User, pr *issues_model.PullRequest) {
 | 
			
		||||
	for _, notifier := range notifiers {
 | 
			
		||||
		notifier.NotifyPullRequestSynchronized(doer, pr)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NotifyPullRequestReview notifies new pull request review
 | 
			
		||||
func NotifyPullRequestReview(pr *models.PullRequest, review *models.Review, comment *models.Comment, mentions []*user_model.User) {
 | 
			
		||||
func NotifyPullRequestReview(pr *issues_model.PullRequest, review *issues_model.Review, comment *issues_model.Comment, mentions []*user_model.User) {
 | 
			
		||||
	for _, notifier := range notifiers {
 | 
			
		||||
		notifier.NotifyPullRequestReview(pr, review, comment, mentions)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NotifyPullRequestCodeComment notifies new pull request code comment
 | 
			
		||||
func NotifyPullRequestCodeComment(pr *models.PullRequest, comment *models.Comment, mentions []*user_model.User) {
 | 
			
		||||
func NotifyPullRequestCodeComment(pr *issues_model.PullRequest, comment *issues_model.Comment, mentions []*user_model.User) {
 | 
			
		||||
	for _, notifier := range notifiers {
 | 
			
		||||
		notifier.NotifyPullRequestCodeComment(pr, comment, mentions)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NotifyPullRequestChangeTargetBranch notifies when a pull request's target branch was changed
 | 
			
		||||
func NotifyPullRequestChangeTargetBranch(doer *user_model.User, pr *models.PullRequest, oldBranch string) {
 | 
			
		||||
func NotifyPullRequestChangeTargetBranch(doer *user_model.User, pr *issues_model.PullRequest, oldBranch string) {
 | 
			
		||||
	for _, notifier := range notifiers {
 | 
			
		||||
		notifier.NotifyPullRequestChangeTargetBranch(doer, pr, oldBranch)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NotifyPullRequestPushCommits notifies when push commits to pull request's head branch
 | 
			
		||||
func NotifyPullRequestPushCommits(doer *user_model.User, pr *models.PullRequest, comment *models.Comment) {
 | 
			
		||||
func NotifyPullRequestPushCommits(doer *user_model.User, pr *issues_model.PullRequest, comment *issues_model.Comment) {
 | 
			
		||||
	for _, notifier := range notifiers {
 | 
			
		||||
		notifier.NotifyPullRequestPushCommits(doer, pr, comment)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NotifyPullRevieweDismiss notifies when a review was dismissed by repo admin
 | 
			
		||||
func NotifyPullRevieweDismiss(doer *user_model.User, review *models.Review, comment *models.Comment) {
 | 
			
		||||
func NotifyPullRevieweDismiss(doer *user_model.User, review *issues_model.Review, comment *issues_model.Comment) {
 | 
			
		||||
	for _, notifier := range notifiers {
 | 
			
		||||
		notifier.NotifyPullRevieweDismiss(doer, review, comment)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NotifyUpdateComment notifies update comment to notifiers
 | 
			
		||||
func NotifyUpdateComment(doer *user_model.User, c *models.Comment, oldContent string) {
 | 
			
		||||
func NotifyUpdateComment(doer *user_model.User, c *issues_model.Comment, oldContent string) {
 | 
			
		||||
	for _, notifier := range notifiers {
 | 
			
		||||
		notifier.NotifyUpdateComment(doer, c, oldContent)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NotifyDeleteComment notifies delete comment to notifiers
 | 
			
		||||
func NotifyDeleteComment(doer *user_model.User, c *models.Comment) {
 | 
			
		||||
func NotifyDeleteComment(doer *user_model.User, c *issues_model.Comment) {
 | 
			
		||||
	for _, notifier := range notifiers {
 | 
			
		||||
		notifier.NotifyDeleteComment(doer, c)
 | 
			
		||||
	}
 | 
			
		||||
@@ -160,57 +161,57 @@ func NotifyDeleteRelease(doer *user_model.User, rel *models.Release) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NotifyIssueChangeMilestone notifies change milestone to notifiers
 | 
			
		||||
func NotifyIssueChangeMilestone(doer *user_model.User, issue *models.Issue, oldMilestoneID int64) {
 | 
			
		||||
func NotifyIssueChangeMilestone(doer *user_model.User, issue *issues_model.Issue, oldMilestoneID int64) {
 | 
			
		||||
	for _, notifier := range notifiers {
 | 
			
		||||
		notifier.NotifyIssueChangeMilestone(doer, issue, oldMilestoneID)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NotifyIssueChangeContent notifies change content to notifiers
 | 
			
		||||
func NotifyIssueChangeContent(doer *user_model.User, issue *models.Issue, oldContent string) {
 | 
			
		||||
func NotifyIssueChangeContent(doer *user_model.User, issue *issues_model.Issue, oldContent string) {
 | 
			
		||||
	for _, notifier := range notifiers {
 | 
			
		||||
		notifier.NotifyIssueChangeContent(doer, issue, oldContent)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NotifyIssueChangeAssignee notifies change content to notifiers
 | 
			
		||||
func NotifyIssueChangeAssignee(doer *user_model.User, issue *models.Issue, assignee *user_model.User, removed bool, comment *models.Comment) {
 | 
			
		||||
func NotifyIssueChangeAssignee(doer *user_model.User, issue *issues_model.Issue, assignee *user_model.User, removed bool, comment *issues_model.Comment) {
 | 
			
		||||
	for _, notifier := range notifiers {
 | 
			
		||||
		notifier.NotifyIssueChangeAssignee(doer, issue, assignee, removed, comment)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NotifyPullReviewRequest notifies Request Review change
 | 
			
		||||
func NotifyPullReviewRequest(doer *user_model.User, issue *models.Issue, reviewer *user_model.User, isRequest bool, comment *models.Comment) {
 | 
			
		||||
func NotifyPullReviewRequest(doer *user_model.User, issue *issues_model.Issue, reviewer *user_model.User, isRequest bool, comment *issues_model.Comment) {
 | 
			
		||||
	for _, notifier := range notifiers {
 | 
			
		||||
		notifier.NotifyPullReviewRequest(doer, issue, reviewer, isRequest, comment)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NotifyIssueClearLabels notifies clear labels to notifiers
 | 
			
		||||
func NotifyIssueClearLabels(doer *user_model.User, issue *models.Issue) {
 | 
			
		||||
func NotifyIssueClearLabels(doer *user_model.User, issue *issues_model.Issue) {
 | 
			
		||||
	for _, notifier := range notifiers {
 | 
			
		||||
		notifier.NotifyIssueClearLabels(doer, issue)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NotifyIssueChangeTitle notifies change title to notifiers
 | 
			
		||||
func NotifyIssueChangeTitle(doer *user_model.User, issue *models.Issue, oldTitle string) {
 | 
			
		||||
func NotifyIssueChangeTitle(doer *user_model.User, issue *issues_model.Issue, oldTitle string) {
 | 
			
		||||
	for _, notifier := range notifiers {
 | 
			
		||||
		notifier.NotifyIssueChangeTitle(doer, issue, oldTitle)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NotifyIssueChangeRef notifies change reference to notifiers
 | 
			
		||||
func NotifyIssueChangeRef(doer *user_model.User, issue *models.Issue, oldRef string) {
 | 
			
		||||
func NotifyIssueChangeRef(doer *user_model.User, issue *issues_model.Issue, oldRef string) {
 | 
			
		||||
	for _, notifier := range notifiers {
 | 
			
		||||
		notifier.NotifyIssueChangeRef(doer, issue, oldRef)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NotifyIssueChangeLabels notifies change labels to notifiers
 | 
			
		||||
func NotifyIssueChangeLabels(doer *user_model.User, issue *models.Issue,
 | 
			
		||||
	addedLabels, removedLabels []*models.Label,
 | 
			
		||||
func NotifyIssueChangeLabels(doer *user_model.User, issue *issues_model.Issue,
 | 
			
		||||
	addedLabels, removedLabels []*issues_model.Label,
 | 
			
		||||
) {
 | 
			
		||||
	for _, notifier := range notifiers {
 | 
			
		||||
		notifier.NotifyIssueChangeLabels(doer, issue, addedLabels, removedLabels)
 | 
			
		||||
 
 | 
			
		||||
@@ -7,6 +7,7 @@ package ui
 | 
			
		||||
import (
 | 
			
		||||
	"code.gitea.io/gitea/models"
 | 
			
		||||
	"code.gitea.io/gitea/models/db"
 | 
			
		||||
	issues_model "code.gitea.io/gitea/models/issues"
 | 
			
		||||
	repo_model "code.gitea.io/gitea/models/repo"
 | 
			
		||||
	user_model "code.gitea.io/gitea/models/user"
 | 
			
		||||
	"code.gitea.io/gitea/modules/graceful"
 | 
			
		||||
@@ -53,7 +54,7 @@ func (ns *notificationService) Run() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (ns *notificationService) NotifyCreateIssueComment(doer *user_model.User, repo *repo_model.Repository,
 | 
			
		||||
	issue *models.Issue, comment *models.Comment, mentions []*user_model.User,
 | 
			
		||||
	issue *issues_model.Issue, comment *issues_model.Comment, mentions []*user_model.User,
 | 
			
		||||
) {
 | 
			
		||||
	opts := issueNotificationOpts{
 | 
			
		||||
		IssueID:              issue.ID,
 | 
			
		||||
@@ -76,7 +77,7 @@ func (ns *notificationService) NotifyCreateIssueComment(doer *user_model.User, r
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (ns *notificationService) NotifyNewIssue(issue *models.Issue, mentions []*user_model.User) {
 | 
			
		||||
func (ns *notificationService) NotifyNewIssue(issue *issues_model.Issue, mentions []*user_model.User) {
 | 
			
		||||
	_ = ns.issueQueue.Push(issueNotificationOpts{
 | 
			
		||||
		IssueID:              issue.ID,
 | 
			
		||||
		NotificationAuthorID: issue.Poster.ID,
 | 
			
		||||
@@ -90,19 +91,19 @@ func (ns *notificationService) NotifyNewIssue(issue *models.Issue, mentions []*u
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (ns *notificationService) NotifyIssueChangeStatus(doer *user_model.User, issue *models.Issue, actionComment *models.Comment, isClosed bool) {
 | 
			
		||||
func (ns *notificationService) NotifyIssueChangeStatus(doer *user_model.User, issue *issues_model.Issue, actionComment *issues_model.Comment, isClosed bool) {
 | 
			
		||||
	_ = ns.issueQueue.Push(issueNotificationOpts{
 | 
			
		||||
		IssueID:              issue.ID,
 | 
			
		||||
		NotificationAuthorID: doer.ID,
 | 
			
		||||
	})
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (ns *notificationService) NotifyIssueChangeTitle(doer *user_model.User, issue *models.Issue, oldTitle string) {
 | 
			
		||||
func (ns *notificationService) NotifyIssueChangeTitle(doer *user_model.User, issue *issues_model.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 issue.IsPull && issues_model.HasWorkInProgressPrefix(oldTitle) && !issue.PullRequest.IsWorkInProgress() {
 | 
			
		||||
		_ = ns.issueQueue.Push(issueNotificationOpts{
 | 
			
		||||
			IssueID:              issue.ID,
 | 
			
		||||
			NotificationAuthorID: doer.ID,
 | 
			
		||||
@@ -110,14 +111,14 @@ func (ns *notificationService) NotifyIssueChangeTitle(doer *user_model.User, iss
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (ns *notificationService) NotifyMergePullRequest(pr *models.PullRequest, doer *user_model.User) {
 | 
			
		||||
func (ns *notificationService) NotifyMergePullRequest(pr *issues_model.PullRequest, doer *user_model.User) {
 | 
			
		||||
	_ = ns.issueQueue.Push(issueNotificationOpts{
 | 
			
		||||
		IssueID:              pr.Issue.ID,
 | 
			
		||||
		NotificationAuthorID: doer.ID,
 | 
			
		||||
	})
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (ns *notificationService) NotifyNewPullRequest(pr *models.PullRequest, mentions []*user_model.User) {
 | 
			
		||||
func (ns *notificationService) NotifyNewPullRequest(pr *issues_model.PullRequest, mentions []*user_model.User) {
 | 
			
		||||
	if err := pr.LoadIssue(); err != nil {
 | 
			
		||||
		log.Error("Unable to load issue: %d for pr: %d: Error: %v", pr.IssueID, pr.ID, err)
 | 
			
		||||
		return
 | 
			
		||||
@@ -131,7 +132,7 @@ func (ns *notificationService) NotifyNewPullRequest(pr *models.PullRequest, ment
 | 
			
		||||
	for _, id := range repoWatchers {
 | 
			
		||||
		toNotify[id] = struct{}{}
 | 
			
		||||
	}
 | 
			
		||||
	issueParticipants, err := models.GetParticipantsIDsByIssueID(pr.IssueID)
 | 
			
		||||
	issueParticipants, err := issues_model.GetParticipantsIDsByIssueID(pr.IssueID)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		log.Error("GetParticipantsIDsByIssueID: %v", err)
 | 
			
		||||
		return
 | 
			
		||||
@@ -152,7 +153,7 @@ func (ns *notificationService) NotifyNewPullRequest(pr *models.PullRequest, ment
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (ns *notificationService) NotifyPullRequestReview(pr *models.PullRequest, r *models.Review, c *models.Comment, mentions []*user_model.User) {
 | 
			
		||||
func (ns *notificationService) NotifyPullRequestReview(pr *issues_model.PullRequest, r *issues_model.Review, c *issues_model.Comment, mentions []*user_model.User) {
 | 
			
		||||
	opts := issueNotificationOpts{
 | 
			
		||||
		IssueID:              pr.Issue.ID,
 | 
			
		||||
		NotificationAuthorID: r.Reviewer.ID,
 | 
			
		||||
@@ -174,7 +175,7 @@ func (ns *notificationService) NotifyPullRequestReview(pr *models.PullRequest, r
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (ns *notificationService) NotifyPullRequestCodeComment(pr *models.PullRequest, c *models.Comment, mentions []*user_model.User) {
 | 
			
		||||
func (ns *notificationService) NotifyPullRequestCodeComment(pr *issues_model.PullRequest, c *issues_model.Comment, mentions []*user_model.User) {
 | 
			
		||||
	for _, mention := range mentions {
 | 
			
		||||
		_ = ns.issueQueue.Push(issueNotificationOpts{
 | 
			
		||||
			IssueID:              pr.Issue.ID,
 | 
			
		||||
@@ -185,7 +186,7 @@ func (ns *notificationService) NotifyPullRequestCodeComment(pr *models.PullReque
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (ns *notificationService) NotifyPullRequestPushCommits(doer *user_model.User, pr *models.PullRequest, comment *models.Comment) {
 | 
			
		||||
func (ns *notificationService) NotifyPullRequestPushCommits(doer *user_model.User, pr *issues_model.PullRequest, comment *issues_model.Comment) {
 | 
			
		||||
	opts := issueNotificationOpts{
 | 
			
		||||
		IssueID:              pr.IssueID,
 | 
			
		||||
		NotificationAuthorID: doer.ID,
 | 
			
		||||
@@ -194,7 +195,7 @@ func (ns *notificationService) NotifyPullRequestPushCommits(doer *user_model.Use
 | 
			
		||||
	_ = ns.issueQueue.Push(opts)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (ns *notificationService) NotifyPullRevieweDismiss(doer *user_model.User, review *models.Review, comment *models.Comment) {
 | 
			
		||||
func (ns *notificationService) NotifyPullRevieweDismiss(doer *user_model.User, review *issues_model.Review, comment *issues_model.Comment) {
 | 
			
		||||
	opts := issueNotificationOpts{
 | 
			
		||||
		IssueID:              review.IssueID,
 | 
			
		||||
		NotificationAuthorID: doer.ID,
 | 
			
		||||
@@ -203,7 +204,7 @@ func (ns *notificationService) NotifyPullRevieweDismiss(doer *user_model.User, r
 | 
			
		||||
	_ = ns.issueQueue.Push(opts)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (ns *notificationService) NotifyIssueChangeAssignee(doer *user_model.User, issue *models.Issue, assignee *user_model.User, removed bool, comment *models.Comment) {
 | 
			
		||||
func (ns *notificationService) NotifyIssueChangeAssignee(doer *user_model.User, issue *issues_model.Issue, assignee *user_model.User, removed bool, comment *issues_model.Comment) {
 | 
			
		||||
	if !removed && doer.ID != assignee.ID {
 | 
			
		||||
		opts := issueNotificationOpts{
 | 
			
		||||
			IssueID:              issue.ID,
 | 
			
		||||
@@ -219,7 +220,7 @@ func (ns *notificationService) NotifyIssueChangeAssignee(doer *user_model.User,
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (ns *notificationService) NotifyPullReviewRequest(doer *user_model.User, issue *models.Issue, reviewer *user_model.User, isRequest bool, comment *models.Comment) {
 | 
			
		||||
func (ns *notificationService) NotifyPullReviewRequest(doer *user_model.User, issue *issues_model.Issue, reviewer *user_model.User, isRequest bool, comment *issues_model.Comment) {
 | 
			
		||||
	if isRequest {
 | 
			
		||||
		opts := issueNotificationOpts{
 | 
			
		||||
			IssueID:              issue.ID,
 | 
			
		||||
 
 | 
			
		||||
@@ -9,6 +9,7 @@ import (
 | 
			
		||||
 | 
			
		||||
	"code.gitea.io/gitea/models"
 | 
			
		||||
	"code.gitea.io/gitea/models/db"
 | 
			
		||||
	issues_model "code.gitea.io/gitea/models/issues"
 | 
			
		||||
	packages_model "code.gitea.io/gitea/models/packages"
 | 
			
		||||
	"code.gitea.io/gitea/models/perm"
 | 
			
		||||
	access_model "code.gitea.io/gitea/models/perm/access"
 | 
			
		||||
@@ -39,7 +40,7 @@ func NewNotifier() base.Notifier {
 | 
			
		||||
	return &webhookNotifier{}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (m *webhookNotifier) NotifyIssueClearLabels(doer *user_model.User, issue *models.Issue) {
 | 
			
		||||
func (m *webhookNotifier) NotifyIssueClearLabels(doer *user_model.User, issue *issues_model.Issue) {
 | 
			
		||||
	ctx, _, finished := process.GetManager().AddContext(graceful.GetManager().HammerContext(), fmt.Sprintf("webhook.NotifyIssueClearLabels User: %s[%d] Issue[%d] #%d in [%d]", doer.Name, doer.ID, issue.ID, issue.Index, issue.RepoID))
 | 
			
		||||
	defer finished()
 | 
			
		||||
 | 
			
		||||
@@ -147,7 +148,7 @@ func (m *webhookNotifier) NotifyMigrateRepository(doer, u *user_model.User, repo
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (m *webhookNotifier) NotifyIssueChangeAssignee(doer *user_model.User, issue *models.Issue, assignee *user_model.User, removed bool, comment *models.Comment) {
 | 
			
		||||
func (m *webhookNotifier) NotifyIssueChangeAssignee(doer *user_model.User, issue *issues_model.Issue, assignee *user_model.User, removed bool, comment *issues_model.Comment) {
 | 
			
		||||
	ctx, _, finished := process.GetManager().AddContext(graceful.GetManager().HammerContext(), fmt.Sprintf("webhook.NotifyIssueChangeAssignee User: %s[%d] Issue[%d] #%d in [%d] Assignee %s[%d] removed: %t", doer.Name, doer.ID, issue.ID, issue.Index, issue.RepoID, assignee.Name, assignee.ID, removed))
 | 
			
		||||
	defer finished()
 | 
			
		||||
 | 
			
		||||
@@ -196,7 +197,7 @@ func (m *webhookNotifier) NotifyIssueChangeAssignee(doer *user_model.User, issue
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (m *webhookNotifier) NotifyIssueChangeTitle(doer *user_model.User, issue *models.Issue, oldTitle string) {
 | 
			
		||||
func (m *webhookNotifier) NotifyIssueChangeTitle(doer *user_model.User, issue *issues_model.Issue, oldTitle string) {
 | 
			
		||||
	ctx, _, finished := process.GetManager().AddContext(graceful.GetManager().HammerContext(), fmt.Sprintf("webhook.NotifyIssueChangeTitle User: %s[%d] Issue[%d] #%d in [%d]", doer.Name, doer.ID, issue.ID, issue.Index, issue.RepoID))
 | 
			
		||||
	defer finished()
 | 
			
		||||
 | 
			
		||||
@@ -240,7 +241,7 @@ func (m *webhookNotifier) NotifyIssueChangeTitle(doer *user_model.User, issue *m
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (m *webhookNotifier) NotifyIssueChangeStatus(doer *user_model.User, issue *models.Issue, actionComment *models.Comment, isClosed bool) {
 | 
			
		||||
func (m *webhookNotifier) NotifyIssueChangeStatus(doer *user_model.User, issue *issues_model.Issue, actionComment *issues_model.Comment, isClosed bool) {
 | 
			
		||||
	ctx, _, finished := process.GetManager().AddContext(graceful.GetManager().HammerContext(), fmt.Sprintf("webhook.NotifyIssueChangeStatus User: %s[%d] Issue[%d] #%d in [%d]", doer.Name, doer.ID, issue.ID, issue.Index, issue.RepoID))
 | 
			
		||||
	defer finished()
 | 
			
		||||
 | 
			
		||||
@@ -283,7 +284,7 @@ func (m *webhookNotifier) NotifyIssueChangeStatus(doer *user_model.User, issue *
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (m *webhookNotifier) NotifyNewIssue(issue *models.Issue, mentions []*user_model.User) {
 | 
			
		||||
func (m *webhookNotifier) NotifyNewIssue(issue *issues_model.Issue, mentions []*user_model.User) {
 | 
			
		||||
	if err := issue.LoadRepo(db.DefaultContext); err != nil {
 | 
			
		||||
		log.Error("issue.LoadRepo: %v", err)
 | 
			
		||||
		return
 | 
			
		||||
@@ -305,7 +306,7 @@ func (m *webhookNotifier) NotifyNewIssue(issue *models.Issue, mentions []*user_m
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (m *webhookNotifier) NotifyNewPullRequest(pull *models.PullRequest, mentions []*user_model.User) {
 | 
			
		||||
func (m *webhookNotifier) NotifyNewPullRequest(pull *issues_model.PullRequest, mentions []*user_model.User) {
 | 
			
		||||
	ctx, _, finished := process.GetManager().AddContext(graceful.GetManager().HammerContext(), fmt.Sprintf("webhook.NotifyNewPullRequest Pull[%d] #%d in [%d]", pull.ID, pull.Index, pull.BaseRepoID))
 | 
			
		||||
	defer finished()
 | 
			
		||||
 | 
			
		||||
@@ -334,7 +335,7 @@ func (m *webhookNotifier) NotifyNewPullRequest(pull *models.PullRequest, mention
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (m *webhookNotifier) NotifyIssueChangeContent(doer *user_model.User, issue *models.Issue, oldContent string) {
 | 
			
		||||
func (m *webhookNotifier) NotifyIssueChangeContent(doer *user_model.User, issue *issues_model.Issue, oldContent string) {
 | 
			
		||||
	ctx, _, finished := process.GetManager().AddContext(graceful.GetManager().HammerContext(), fmt.Sprintf("webhook.NotifyIssueChangeContent User: %s[%d] Issue[%d] #%d in [%d]", doer.Name, doer.ID, issue.ID, issue.Index, issue.RepoID))
 | 
			
		||||
	defer finished()
 | 
			
		||||
 | 
			
		||||
@@ -373,7 +374,7 @@ func (m *webhookNotifier) NotifyIssueChangeContent(doer *user_model.User, issue
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (m *webhookNotifier) NotifyUpdateComment(doer *user_model.User, c *models.Comment, oldContent string) {
 | 
			
		||||
func (m *webhookNotifier) NotifyUpdateComment(doer *user_model.User, c *issues_model.Comment, oldContent string) {
 | 
			
		||||
	var err error
 | 
			
		||||
 | 
			
		||||
	if err = c.LoadPoster(); err != nil {
 | 
			
		||||
@@ -385,7 +386,7 @@ func (m *webhookNotifier) NotifyUpdateComment(doer *user_model.User, c *models.C
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if err = c.Issue.LoadAttributes(); err != nil {
 | 
			
		||||
	if err = c.Issue.LoadAttributes(db.DefaultContext); err != nil {
 | 
			
		||||
		log.Error("LoadAttributes: %v", err)
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
@@ -427,7 +428,7 @@ func (m *webhookNotifier) NotifyUpdateComment(doer *user_model.User, c *models.C
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (m *webhookNotifier) NotifyCreateIssueComment(doer *user_model.User, repo *repo_model.Repository,
 | 
			
		||||
	issue *models.Issue, comment *models.Comment, mentions []*user_model.User,
 | 
			
		||||
	issue *issues_model.Issue, comment *issues_model.Comment, mentions []*user_model.User,
 | 
			
		||||
) {
 | 
			
		||||
	mode, _ := access_model.AccessLevel(doer, repo)
 | 
			
		||||
 | 
			
		||||
@@ -457,7 +458,7 @@ func (m *webhookNotifier) NotifyCreateIssueComment(doer *user_model.User, repo *
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (m *webhookNotifier) NotifyDeleteComment(doer *user_model.User, comment *models.Comment) {
 | 
			
		||||
func (m *webhookNotifier) NotifyDeleteComment(doer *user_model.User, comment *issues_model.Comment) {
 | 
			
		||||
	var err error
 | 
			
		||||
 | 
			
		||||
	if err = comment.LoadPoster(); err != nil {
 | 
			
		||||
@@ -469,7 +470,7 @@ func (m *webhookNotifier) NotifyDeleteComment(doer *user_model.User, comment *mo
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if err = comment.Issue.LoadAttributes(); err != nil {
 | 
			
		||||
	if err = comment.Issue.LoadAttributes(db.DefaultContext); err != nil {
 | 
			
		||||
		log.Error("LoadAttributes: %v", err)
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
@@ -501,8 +502,8 @@ func (m *webhookNotifier) NotifyDeleteComment(doer *user_model.User, comment *mo
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (m *webhookNotifier) NotifyIssueChangeLabels(doer *user_model.User, issue *models.Issue,
 | 
			
		||||
	addedLabels, removedLabels []*models.Label,
 | 
			
		||||
func (m *webhookNotifier) NotifyIssueChangeLabels(doer *user_model.User, issue *issues_model.Issue,
 | 
			
		||||
	addedLabels, removedLabels []*issues_model.Label,
 | 
			
		||||
) {
 | 
			
		||||
	ctx, _, finished := process.GetManager().AddContext(graceful.GetManager().HammerContext(), fmt.Sprintf("webhook.NotifyIssueChangeLabels User: %s[%d] Issue[%d] #%d in [%d]", doer.Name, doer.ID, issue.ID, issue.Index, issue.RepoID))
 | 
			
		||||
	defer finished()
 | 
			
		||||
@@ -550,7 +551,7 @@ func (m *webhookNotifier) NotifyIssueChangeLabels(doer *user_model.User, issue *
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (m *webhookNotifier) NotifyIssueChangeMilestone(doer *user_model.User, issue *models.Issue, oldMilestoneID int64) {
 | 
			
		||||
func (m *webhookNotifier) NotifyIssueChangeMilestone(doer *user_model.User, issue *issues_model.Issue, oldMilestoneID int64) {
 | 
			
		||||
	ctx, _, finished := process.GetManager().AddContext(graceful.GetManager().HammerContext(), fmt.Sprintf("webhook.NotifyIssueChangeMilestone User: %s[%d] Issue[%d] #%d in [%d]", doer.Name, doer.ID, issue.ID, issue.Index, issue.RepoID))
 | 
			
		||||
	defer finished()
 | 
			
		||||
 | 
			
		||||
@@ -562,7 +563,7 @@ func (m *webhookNotifier) NotifyIssueChangeMilestone(doer *user_model.User, issu
 | 
			
		||||
		hookAction = api.HookIssueDemilestoned
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if err = issue.LoadAttributes(); err != nil {
 | 
			
		||||
	if err = issue.LoadAttributes(db.DefaultContext); err != nil {
 | 
			
		||||
		log.Error("issue.LoadAttributes failed: %v", err)
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
@@ -621,7 +622,7 @@ func (m *webhookNotifier) NotifyPushCommits(pusher *user_model.User, repo *repo_
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (*webhookNotifier) NotifyMergePullRequest(pr *models.PullRequest, doer *user_model.User) {
 | 
			
		||||
func (*webhookNotifier) NotifyMergePullRequest(pr *issues_model.PullRequest, doer *user_model.User) {
 | 
			
		||||
	ctx, _, finished := process.GetManager().AddContext(graceful.GetManager().HammerContext(), fmt.Sprintf("webhook.NotifyMergePullRequest Pull[%d] #%d in [%d]", pr.ID, pr.Index, pr.BaseRepoID))
 | 
			
		||||
	defer finished()
 | 
			
		||||
 | 
			
		||||
@@ -662,7 +663,7 @@ func (*webhookNotifier) NotifyMergePullRequest(pr *models.PullRequest, doer *use
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (m *webhookNotifier) NotifyPullRequestChangeTargetBranch(doer *user_model.User, pr *models.PullRequest, oldBranch string) {
 | 
			
		||||
func (m *webhookNotifier) NotifyPullRequestChangeTargetBranch(doer *user_model.User, pr *issues_model.PullRequest, oldBranch string) {
 | 
			
		||||
	ctx, _, finished := process.GetManager().AddContext(graceful.GetManager().HammerContext(), fmt.Sprintf("webhook.NotifyPullRequestChangeTargetBranch Pull[%d] #%d in [%d]", pr.ID, pr.Index, pr.BaseRepoID))
 | 
			
		||||
	defer finished()
 | 
			
		||||
 | 
			
		||||
@@ -696,18 +697,18 @@ func (m *webhookNotifier) NotifyPullRequestChangeTargetBranch(doer *user_model.U
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (m *webhookNotifier) NotifyPullRequestReview(pr *models.PullRequest, review *models.Review, comment *models.Comment, mentions []*user_model.User) {
 | 
			
		||||
func (m *webhookNotifier) NotifyPullRequestReview(pr *issues_model.PullRequest, review *issues_model.Review, comment *issues_model.Comment, mentions []*user_model.User) {
 | 
			
		||||
	ctx, _, finished := process.GetManager().AddContext(graceful.GetManager().HammerContext(), fmt.Sprintf("webhook.NotifyPullRequestReview Pull[%d] #%d in [%d]", pr.ID, pr.Index, pr.BaseRepoID))
 | 
			
		||||
	defer finished()
 | 
			
		||||
 | 
			
		||||
	var reviewHookType webhook.HookEventType
 | 
			
		||||
 | 
			
		||||
	switch review.Type {
 | 
			
		||||
	case models.ReviewTypeApprove:
 | 
			
		||||
	case issues_model.ReviewTypeApprove:
 | 
			
		||||
		reviewHookType = webhook.HookEventPullRequestReviewApproved
 | 
			
		||||
	case models.ReviewTypeComment:
 | 
			
		||||
	case issues_model.ReviewTypeComment:
 | 
			
		||||
		reviewHookType = webhook.HookEventPullRequestComment
 | 
			
		||||
	case models.ReviewTypeReject:
 | 
			
		||||
	case issues_model.ReviewTypeReject:
 | 
			
		||||
		reviewHookType = webhook.HookEventPullRequestReviewRejected
 | 
			
		||||
	default:
 | 
			
		||||
		// unsupported review webhook type here
 | 
			
		||||
@@ -756,7 +757,7 @@ func (m *webhookNotifier) NotifyCreateRef(pusher *user_model.User, repo *repo_mo
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (m *webhookNotifier) NotifyPullRequestSynchronized(doer *user_model.User, pr *models.PullRequest) {
 | 
			
		||||
func (m *webhookNotifier) NotifyPullRequestSynchronized(doer *user_model.User, pr *issues_model.PullRequest) {
 | 
			
		||||
	ctx, _, finished := process.GetManager().AddContext(graceful.GetManager().HammerContext(), fmt.Sprintf("webhook.NotifyPullRequestSynchronized Pull[%d] #%d in [%d]", pr.ID, pr.Index, pr.BaseRepoID))
 | 
			
		||||
	defer finished()
 | 
			
		||||
 | 
			
		||||
@@ -764,7 +765,7 @@ func (m *webhookNotifier) NotifyPullRequestSynchronized(doer *user_model.User, p
 | 
			
		||||
		log.Error("pr.LoadIssue: %v", err)
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	if err := pr.Issue.LoadAttributes(); err != nil {
 | 
			
		||||
	if err := pr.Issue.LoadAttributes(db.DefaultContext); err != nil {
 | 
			
		||||
		log.Error("LoadAttributes: %v", err)
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user