|
|
|
@ -49,7 +49,7 @@ func (a *actionNotifier) NewIssue(ctx context.Context, issue *issues_model.Issue
|
|
|
|
|
}
|
|
|
|
|
repo := issue.Repo
|
|
|
|
|
|
|
|
|
|
if err := activities_model.NotifyWatchers(ctx, &activities_model.Action{
|
|
|
|
|
if err := NotifyWatchers(ctx, &activities_model.Action{
|
|
|
|
|
ActUserID: issue.Poster.ID,
|
|
|
|
|
ActUser: issue.Poster,
|
|
|
|
|
OpType: activities_model.ActionCreateIssue,
|
|
|
|
@ -90,7 +90,7 @@ func (a *actionNotifier) IssueChangeStatus(ctx context.Context, doer *user_model
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Notify watchers for whatever action comes in, ignore if no action type.
|
|
|
|
|
if err := activities_model.NotifyWatchers(ctx, act); err != nil {
|
|
|
|
|
if err := NotifyWatchers(ctx, act); err != nil {
|
|
|
|
|
log.Error("NotifyWatchers: %v", err)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -126,7 +126,7 @@ func (a *actionNotifier) CreateIssueComment(ctx context.Context, doer *user_mode
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Notify watchers for whatever action comes in, ignore if no action type.
|
|
|
|
|
if err := activities_model.NotifyWatchers(ctx, act); err != nil {
|
|
|
|
|
if err := NotifyWatchers(ctx, act); err != nil {
|
|
|
|
|
log.Error("NotifyWatchers: %v", err)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -145,7 +145,7 @@ func (a *actionNotifier) NewPullRequest(ctx context.Context, pull *issues_model.
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if err := activities_model.NotifyWatchers(ctx, &activities_model.Action{
|
|
|
|
|
if err := NotifyWatchers(ctx, &activities_model.Action{
|
|
|
|
|
ActUserID: pull.Issue.Poster.ID,
|
|
|
|
|
ActUser: pull.Issue.Poster,
|
|
|
|
|
OpType: activities_model.ActionCreatePullRequest,
|
|
|
|
@ -159,7 +159,7 @@ func (a *actionNotifier) NewPullRequest(ctx context.Context, pull *issues_model.
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (a *actionNotifier) RenameRepository(ctx context.Context, doer *user_model.User, repo *repo_model.Repository, oldRepoName string) {
|
|
|
|
|
if err := activities_model.NotifyWatchers(ctx, &activities_model.Action{
|
|
|
|
|
if err := NotifyWatchers(ctx, &activities_model.Action{
|
|
|
|
|
ActUserID: doer.ID,
|
|
|
|
|
ActUser: doer,
|
|
|
|
|
OpType: activities_model.ActionRenameRepo,
|
|
|
|
@ -173,7 +173,7 @@ func (a *actionNotifier) RenameRepository(ctx context.Context, doer *user_model.
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (a *actionNotifier) TransferRepository(ctx context.Context, doer *user_model.User, repo *repo_model.Repository, oldOwnerName string) {
|
|
|
|
|
if err := activities_model.NotifyWatchers(ctx, &activities_model.Action{
|
|
|
|
|
if err := NotifyWatchers(ctx, &activities_model.Action{
|
|
|
|
|
ActUserID: doer.ID,
|
|
|
|
|
ActUser: doer,
|
|
|
|
|
OpType: activities_model.ActionTransferRepo,
|
|
|
|
@ -187,7 +187,7 @@ func (a *actionNotifier) TransferRepository(ctx context.Context, doer *user_mode
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (a *actionNotifier) CreateRepository(ctx context.Context, doer, u *user_model.User, repo *repo_model.Repository) {
|
|
|
|
|
if err := activities_model.NotifyWatchers(ctx, &activities_model.Action{
|
|
|
|
|
if err := NotifyWatchers(ctx, &activities_model.Action{
|
|
|
|
|
ActUserID: doer.ID,
|
|
|
|
|
ActUser: doer,
|
|
|
|
|
OpType: activities_model.ActionCreateRepo,
|
|
|
|
@ -200,7 +200,7 @@ func (a *actionNotifier) CreateRepository(ctx context.Context, doer, u *user_mod
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (a *actionNotifier) ForkRepository(ctx context.Context, doer *user_model.User, oldRepo, repo *repo_model.Repository) {
|
|
|
|
|
if err := activities_model.NotifyWatchers(ctx, &activities_model.Action{
|
|
|
|
|
if err := NotifyWatchers(ctx, &activities_model.Action{
|
|
|
|
|
ActUserID: doer.ID,
|
|
|
|
|
ActUser: doer,
|
|
|
|
|
OpType: activities_model.ActionCreateRepo,
|
|
|
|
@ -265,13 +265,13 @@ func (a *actionNotifier) PullRequestReview(ctx context.Context, pr *issues_model
|
|
|
|
|
actions = append(actions, action)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if err := activities_model.NotifyWatchersActions(ctx, actions); err != nil {
|
|
|
|
|
if err := NotifyWatchers(ctx, actions...); err != nil {
|
|
|
|
|
log.Error("notify watchers '%d/%d': %v", review.Reviewer.ID, review.Issue.RepoID, err)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (*actionNotifier) MergePullRequest(ctx context.Context, doer *user_model.User, pr *issues_model.PullRequest) {
|
|
|
|
|
if err := activities_model.NotifyWatchers(ctx, &activities_model.Action{
|
|
|
|
|
if err := NotifyWatchers(ctx, &activities_model.Action{
|
|
|
|
|
ActUserID: doer.ID,
|
|
|
|
|
ActUser: doer,
|
|
|
|
|
OpType: activities_model.ActionMergePullRequest,
|
|
|
|
@ -285,7 +285,7 @@ func (*actionNotifier) MergePullRequest(ctx context.Context, doer *user_model.Us
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (*actionNotifier) AutoMergePullRequest(ctx context.Context, doer *user_model.User, pr *issues_model.PullRequest) {
|
|
|
|
|
if err := activities_model.NotifyWatchers(ctx, &activities_model.Action{
|
|
|
|
|
if err := NotifyWatchers(ctx, &activities_model.Action{
|
|
|
|
|
ActUserID: doer.ID,
|
|
|
|
|
ActUser: doer,
|
|
|
|
|
OpType: activities_model.ActionAutoMergePullRequest,
|
|
|
|
@ -303,7 +303,7 @@ func (*actionNotifier) NotifyPullRevieweDismiss(ctx context.Context, doer *user_
|
|
|
|
|
if len(review.OriginalAuthor) > 0 {
|
|
|
|
|
reviewerName = review.OriginalAuthor
|
|
|
|
|
}
|
|
|
|
|
if err := activities_model.NotifyWatchers(ctx, &activities_model.Action{
|
|
|
|
|
if err := NotifyWatchers(ctx, &activities_model.Action{
|
|
|
|
|
ActUserID: doer.ID,
|
|
|
|
|
ActUser: doer,
|
|
|
|
|
OpType: activities_model.ActionPullReviewDismissed,
|
|
|
|
@ -337,7 +337,7 @@ func (a *actionNotifier) PushCommits(ctx context.Context, pusher *user_model.Use
|
|
|
|
|
opType = activities_model.ActionDeleteBranch
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if err = activities_model.NotifyWatchers(ctx, &activities_model.Action{
|
|
|
|
|
if err = NotifyWatchers(ctx, &activities_model.Action{
|
|
|
|
|
ActUserID: pusher.ID,
|
|
|
|
|
ActUser: pusher,
|
|
|
|
|
OpType: opType,
|
|
|
|
@ -357,7 +357,7 @@ func (a *actionNotifier) CreateRef(ctx context.Context, doer *user_model.User, r
|
|
|
|
|
// has sent same action in `PushCommits`, so skip it.
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if err := activities_model.NotifyWatchers(ctx, &activities_model.Action{
|
|
|
|
|
if err := NotifyWatchers(ctx, &activities_model.Action{
|
|
|
|
|
ActUserID: doer.ID,
|
|
|
|
|
ActUser: doer,
|
|
|
|
|
OpType: opType,
|
|
|
|
@ -376,7 +376,7 @@ func (a *actionNotifier) DeleteRef(ctx context.Context, doer *user_model.User, r
|
|
|
|
|
// has sent same action in `PushCommits`, so skip it.
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if err := activities_model.NotifyWatchers(ctx, &activities_model.Action{
|
|
|
|
|
if err := NotifyWatchers(ctx, &activities_model.Action{
|
|
|
|
|
ActUserID: doer.ID,
|
|
|
|
|
ActUser: doer,
|
|
|
|
|
OpType: opType,
|
|
|
|
@ -402,7 +402,7 @@ func (a *actionNotifier) SyncPushCommits(ctx context.Context, pusher *user_model
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if err := activities_model.NotifyWatchers(ctx, &activities_model.Action{
|
|
|
|
|
if err := NotifyWatchers(ctx, &activities_model.Action{
|
|
|
|
|
ActUserID: repo.OwnerID,
|
|
|
|
|
ActUser: repo.MustOwner(ctx),
|
|
|
|
|
OpType: activities_model.ActionMirrorSyncPush,
|
|
|
|
@ -423,7 +423,7 @@ func (a *actionNotifier) SyncCreateRef(ctx context.Context, doer *user_model.Use
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if err := activities_model.NotifyWatchers(ctx, &activities_model.Action{
|
|
|
|
|
if err := NotifyWatchers(ctx, &activities_model.Action{
|
|
|
|
|
ActUserID: repo.OwnerID,
|
|
|
|
|
ActUser: repo.MustOwner(ctx),
|
|
|
|
|
OpType: activities_model.ActionMirrorSyncCreate,
|
|
|
|
@ -443,7 +443,7 @@ func (a *actionNotifier) SyncDeleteRef(ctx context.Context, doer *user_model.Use
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if err := activities_model.NotifyWatchers(ctx, &activities_model.Action{
|
|
|
|
|
if err := NotifyWatchers(ctx, &activities_model.Action{
|
|
|
|
|
ActUserID: repo.OwnerID,
|
|
|
|
|
ActUser: repo.MustOwner(ctx),
|
|
|
|
|
OpType: activities_model.ActionMirrorSyncDelete,
|
|
|
|
@ -461,7 +461,7 @@ func (a *actionNotifier) NewRelease(ctx context.Context, rel *repo_model.Release
|
|
|
|
|
log.Error("LoadAttributes: %v", err)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if err := activities_model.NotifyWatchers(ctx, &activities_model.Action{
|
|
|
|
|
if err := NotifyWatchers(ctx, &activities_model.Action{
|
|
|
|
|
ActUserID: rel.PublisherID,
|
|
|
|
|
ActUser: rel.Publisher,
|
|
|
|
|
OpType: activities_model.ActionPublishRelease,
|
|
|
|
|