mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-02 10:23:46 +00:00
Fix #148
This commit is contained in:
parent
89c99167b2
commit
a2333d95d5
1 changed files with 16 additions and 6 deletions
|
@ -88,12 +88,6 @@ func CommitRepoAction(userId int64, userName, actEmail string,
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = NotifyWatchers(&Action{ActUserId: userId, ActUserName: userName, ActEmail: actEmail,
|
|
||||||
OpType: opType, Content: string(bs), RepoId: repoId, RepoName: repoName, RefName: refName}); err != nil {
|
|
||||||
log.Error("action.CommitRepoAction(notify watchers): %d/%s", userId, repoName)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Change repository bare status and update last updated time.
|
// Change repository bare status and update last updated time.
|
||||||
repo, err := GetRepositoryByName(userId, repoName)
|
repo, err := GetRepositoryByName(userId, repoName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -106,12 +100,24 @@ func CommitRepoAction(userId int64, userName, actEmail string,
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !repo.IsPrivate {
|
||||||
|
if err = NotifyWatchers(&Action{ActUserId: userId, ActUserName: userName, ActEmail: actEmail,
|
||||||
|
OpType: opType, Content: string(bs), RepoId: repoId, RepoName: repoName, RefName: refName}); err != nil {
|
||||||
|
log.Error("action.CommitRepoAction(notify watchers): %d/%s", userId, repoName)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
log.Trace("action.CommitRepoAction(end): %d/%s", userId, repoName)
|
log.Trace("action.CommitRepoAction(end): %d/%s", userId, repoName)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewRepoAction adds new action for creating repository.
|
// NewRepoAction adds new action for creating repository.
|
||||||
func NewRepoAction(user *User, repo *Repository) (err error) {
|
func NewRepoAction(user *User, repo *Repository) (err error) {
|
||||||
|
if repo.IsPrivate {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
if err = NotifyWatchers(&Action{ActUserId: user.Id, ActUserName: user.Name, ActEmail: user.Email,
|
if err = NotifyWatchers(&Action{ActUserId: user.Id, ActUserName: user.Name, ActEmail: user.Email,
|
||||||
OpType: OP_CREATE_REPO, RepoId: repo.Id, RepoName: repo.Name}); err != nil {
|
OpType: OP_CREATE_REPO, RepoId: repo.Id, RepoName: repo.Name}); err != nil {
|
||||||
log.Error("action.NewRepoAction(notify watchers): %d/%s", user.Id, repo.Name)
|
log.Error("action.NewRepoAction(notify watchers): %d/%s", user.Id, repo.Name)
|
||||||
|
@ -124,6 +130,10 @@ func NewRepoAction(user *User, repo *Repository) (err error) {
|
||||||
|
|
||||||
// TransferRepoAction adds new action for transfering repository.
|
// TransferRepoAction adds new action for transfering repository.
|
||||||
func TransferRepoAction(user, newUser *User, repo *Repository) (err error) {
|
func TransferRepoAction(user, newUser *User, repo *Repository) (err error) {
|
||||||
|
if repo.IsPrivate {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
if err = NotifyWatchers(&Action{ActUserId: user.Id, ActUserName: user.Name, ActEmail: user.Email,
|
if err = NotifyWatchers(&Action{ActUserId: user.Id, ActUserName: user.Name, ActEmail: user.Email,
|
||||||
OpType: OP_TRANSFER_REPO, RepoId: repo.Id, RepoName: repo.Name, Content: newUser.Name}); err != nil {
|
OpType: OP_TRANSFER_REPO, RepoId: repo.Id, RepoName: repo.Name, Content: newUser.Name}); err != nil {
|
||||||
log.Error("action.TransferRepoAction(notify watchers): %d/%s", user.Id, repo.Name)
|
log.Error("action.TransferRepoAction(notify watchers): %d/%s", user.Id, repo.Name)
|
||||||
|
|
Loading…
Reference in a new issue