mirror of
https://gitcode.com/gitea/gitea.git
synced 2025-07-09 22:55:51 +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:
integrations
api_comment_test.goapi_issue_label_test.goapi_issue_reaction_test.goapi_issue_stopwatch_test.goapi_issue_subscription_test.goapi_issue_test.goapi_issue_tracked_time_test.goapi_pull_commits_test.goapi_pull_review_test.goapi_pull_test.godelete_user_test.gogit_test.goissue_test.gopull_merge_test.gopull_update_test.gouser_test.go
models
action.goaction_test.gobranch.goconsistency.goconsistency_test.go
db
error.gogit
issue_label_test.goissue_stopwatch_test.goissue_user_test.goissues
assignees.goassignees_test.gocomment.gocomment_list.gocomment_test.gocontent_history.gocontent_history_test.godependency.godependency_test.goissue.goissue_index.goissue_list.goissue_list_test.goissue_lock.goissue_project.goissue_test.goissue_user.goissue_user_test.goissue_watch.goissue_watch_test.goissue_xref.goissue_xref_test.golabel.golabel_test.gomain_test.gomilestone.gomilestone_test.gopull.gopull_list.gopull_test.goreaction_test.goreview.goreview_test.gostopwatch.gostopwatch_test.gotracked_time.gotracked_time_test.go
main_test.gomigrate.gomigrate_test.gomigrations
notification.gonotification_test.goorg_team.gorepo.gorepo
repo_activity.gorepo_collaboration.gorepo_transfer.gostatistic.gouser.gomodules
context
convert
doctor
eventsource
indexer/issues
notification
repository
templates
routers
api/v1
misc
notify
org
repo
private
web
services
agit
asymkey
automerge
comments
forms
gitdiff
issue
assignee.goassignee_test.gocommit.gocommit_test.gocontent.goissue.goissue_test.golabel.golabel_test.gomilestone.gomilestone_test.gostatus.go
mailer
migrations
pull
check.gocheck_test.gocommit_status.goedits.golfs.gomerge.gopatch.gopull.gopull_test.goreview.gotemp_repo.goupdate.go
repository
@ -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,
|
||||
|
Reference in New Issue
Block a user