Skip to content

Commit

Permalink
Fix rename notification bug (#18008)
Browse files Browse the repository at this point in the history
  • Loading branch information
lunny authored Dec 17, 2021
1 parent d29b689 commit a6d4a85
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 0 additions & 2 deletions modules/notification/action/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,6 @@ func (a *actionNotifier) NotifyNewPullRequest(pull *models.PullRequest, mentions
}

func (a *actionNotifier) NotifyRenameRepository(doer *user_model.User, repo *repo_model.Repository, oldRepoName string) {
log.Trace("action.ChangeRepositoryName: %s/%s", doer.Name, repo.Name)

if err := models.NotifyWatchers(&models.Action{
ActUserID: doer.ID,
ActUser: doer,
Expand Down
4 changes: 4 additions & 0 deletions services/repository/transfer.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"code.gitea.io/gitea/models/perm"
repo_model "code.gitea.io/gitea/models/repo"
user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/notification"
"code.gitea.io/gitea/modules/sync"
)
Expand Down Expand Up @@ -57,6 +58,8 @@ func TransferOwnership(doer, newOwner *user_model.User, repo *repo_model.Reposit

// ChangeRepositoryName changes all corresponding setting from old repository name to new one.
func ChangeRepositoryName(doer *user_model.User, repo *repo_model.Repository, newRepoName string) error {
log.Trace("ChangeRepositoryName: %s/%s -> %s", doer.Name, repo.Name, newRepoName)

oldRepoName := repo.Name

// Change repository directory name. We must lock the local copy of the
Expand All @@ -70,6 +73,7 @@ func ChangeRepositoryName(doer *user_model.User, repo *repo_model.Repository, ne
}
repoWorkingPool.CheckOut(fmt.Sprint(repo.ID))

repo.Name = newRepoName
notification.NotifyRenameRepository(doer, repo, oldRepoName)

return nil
Expand Down

0 comments on commit a6d4a85

Please sign in to comment.