mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Move notification interface to services layer (#26915)
Extract from #22266
This commit is contained in:
@@ -16,8 +16,8 @@ import (
|
||||
system_model "code.gitea.io/gitea/models/system"
|
||||
user_model "code.gitea.io/gitea/models/user"
|
||||
"code.gitea.io/gitea/modules/git"
|
||||
"code.gitea.io/gitea/modules/notification"
|
||||
"code.gitea.io/gitea/modules/storage"
|
||||
notify_service "code.gitea.io/gitea/services/notify"
|
||||
)
|
||||
|
||||
// NewIssue creates new issue with labels for repository.
|
||||
@@ -37,12 +37,12 @@ func NewIssue(ctx context.Context, repo *repo_model.Repository, issue *issues_mo
|
||||
return err
|
||||
}
|
||||
|
||||
notification.NotifyNewIssue(ctx, issue, mentions)
|
||||
notify_service.NewIssue(ctx, issue, mentions)
|
||||
if len(issue.Labels) > 0 {
|
||||
notification.NotifyIssueChangeLabels(ctx, issue.Poster, issue, issue.Labels, nil)
|
||||
notify_service.IssueChangeLabels(ctx, issue.Poster, issue, issue.Labels, nil)
|
||||
}
|
||||
if issue.Milestone != nil {
|
||||
notification.NotifyIssueChangeMilestone(ctx, issue.Poster, issue, 0)
|
||||
notify_service.IssueChangeMilestone(ctx, issue.Poster, issue, 0)
|
||||
}
|
||||
|
||||
return nil
|
||||
@@ -63,7 +63,7 @@ func ChangeTitle(ctx context.Context, issue *issues_model.Issue, doer *user_mode
|
||||
}
|
||||
}
|
||||
|
||||
notification.NotifyIssueChangeTitle(ctx, doer, issue, oldTitle)
|
||||
notify_service.IssueChangeTitle(ctx, doer, issue, oldTitle)
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -77,7 +77,7 @@ func ChangeIssueRef(ctx context.Context, issue *issues_model.Issue, doer *user_m
|
||||
return err
|
||||
}
|
||||
|
||||
notification.NotifyIssueChangeRef(ctx, doer, issue, oldRef)
|
||||
notify_service.IssueChangeRef(ctx, doer, issue, oldRef)
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -166,7 +166,7 @@ func DeleteIssue(ctx context.Context, doer *user_model.User, gitRepo *git.Reposi
|
||||
}
|
||||
}
|
||||
|
||||
notification.NotifyDeleteIssue(ctx, doer, issue)
|
||||
notify_service.DeleteIssue(ctx, doer, issue)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user