mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-28 12:16:17 +01:00
Move notifywatchers from models to notification (#8907)
This commit is contained in:
parent
0e281384b5
commit
273a24f226
2 changed files with 26 additions and 10 deletions
|
@ -1470,16 +1470,6 @@ func createRepository(e *xorm.Session, doer, u *User, repo *Repository) (err err
|
||||||
return fmt.Errorf("watchRepo: %v", err)
|
return fmt.Errorf("watchRepo: %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 {
|
if err = copyDefaultWebhooksToRepo(e, repo.ID); err != nil {
|
||||||
return fmt.Errorf("copyDefaultWebhooksToRepo: %v", err)
|
return fmt.Errorf("copyDefaultWebhooksToRepo: %v", err)
|
||||||
|
|
|
@ -91,3 +91,29 @@ func (a *actionNotifier) NotifyRenameRepository(doer *models.User, repo *models.
|
||||||
log.Trace("action.renameRepoAction: %s/%s", doer.Name, repo.Name)
|
log.Trace("action.renameRepoAction: %s/%s", doer.Name, repo.Name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *actionNotifier) NotifyCreateRepository(doer *models.User, u *models.User, repo *models.Repository) {
|
||||||
|
if err := models.NotifyWatchers(&models.Action{
|
||||||
|
ActUserID: doer.ID,
|
||||||
|
ActUser: doer,
|
||||||
|
OpType: models.ActionCreateRepo,
|
||||||
|
RepoID: repo.ID,
|
||||||
|
Repo: repo,
|
||||||
|
IsPrivate: repo.IsPrivate,
|
||||||
|
}); err != nil {
|
||||||
|
log.Error("notify watchers '%d/%d': %v", doer.ID, repo.ID, err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *actionNotifier) NotifyForkRepository(doer *models.User, oldRepo, repo *models.Repository) {
|
||||||
|
if err := models.NotifyWatchers(&models.Action{
|
||||||
|
ActUserID: doer.ID,
|
||||||
|
ActUser: doer,
|
||||||
|
OpType: models.ActionCreateRepo,
|
||||||
|
RepoID: repo.ID,
|
||||||
|
Repo: repo,
|
||||||
|
IsPrivate: repo.IsPrivate,
|
||||||
|
}); err != nil {
|
||||||
|
log.Error("notify watchers '%d/%d': %v", doer.ID, repo.ID, err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue