Move some actions to notification/action (#8779)

* Move some actions to notification/action

* Fix test

* fix test
This commit is contained in:
Lunny Xiao 2019-11-09 04:54:50 +08:00 committed by techknowlogick
parent fb459f2c2c
commit 016a5d0438
10 changed files with 88 additions and 107 deletions

View file

@ -1469,8 +1469,15 @@ func createRepository(e *xorm.Session, doer, u *User, repo *Repository) (err err
return fmt.Errorf("watchRepo: %v", err)
}
}
if err = newRepoAction(e, doer, repo); err != nil {
return fmt.Errorf("newRepoAction: %v", err)
if err = notifyWatchers(e, &Action{
ActUserID: doer.ID,
ActUser: doer,
OpType: ActionCreateRepo,
RepoID: repo.ID,
Repo: repo,
IsPrivate: repo.IsPrivate,
}); err != nil {
return fmt.Errorf("notify watchers '%d/%d': %v", doer.ID, repo.ID, err)
}
if err = copyDefaultWebhooksToRepo(e, repo.ID); err != nil {