mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	code fix #941 caution: undertest
This commit is contained in:
		@@ -412,21 +412,29 @@ func CommitRepoAction(userId, repoUserId int64, userName, actEmail string,
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewRepoAction adds new action for creating repository.
 | 
			
		||||
func NewRepoAction(u *User, repo *Repository) (err error) {
 | 
			
		||||
	if err = NotifyWatchers(&Action{ActUserId: u.Id, ActUserName: u.Name, ActEmail: u.Email,
 | 
			
		||||
		OpType: CREATE_REPO, RepoId: repo.Id, RepoUserName: repo.Owner.Name, RepoName: repo.Name,
 | 
			
		||||
		IsPrivate: repo.IsPrivate}); err != nil {
 | 
			
		||||
		log.Error(4, "NotifyWatchers: %d/%s", u.Id, repo.Name)
 | 
			
		||||
		return err
 | 
			
		||||
func newRepoAction(e Engine, u *User, repo *Repository) (err error) {
 | 
			
		||||
	if err = notifyWatchers(e, &Action{
 | 
			
		||||
		ActUserId:    u.Id,
 | 
			
		||||
		ActUserName:  u.Name,
 | 
			
		||||
		ActEmail:     u.Email,
 | 
			
		||||
		OpType:       CREATE_REPO,
 | 
			
		||||
		RepoId:       repo.Id,
 | 
			
		||||
		RepoUserName: repo.Owner.Name,
 | 
			
		||||
		RepoName:     repo.Name,
 | 
			
		||||
		IsPrivate:    repo.IsPrivate}); err != nil {
 | 
			
		||||
		return fmt.Errorf("notify watchers '%d/%s'", u.Id, repo.Id)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	log.Trace("action.NewRepoAction: %s/%s", u.Name, repo.Name)
 | 
			
		||||
	return err
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// TransferRepoAction adds new action for transferring repository.
 | 
			
		||||
func TransferRepoAction(u, newUser *User, repo *Repository) (err error) {
 | 
			
		||||
// NewRepoAction adds new action for creating repository.
 | 
			
		||||
func NewRepoAction(u *User, repo *Repository) (err error) {
 | 
			
		||||
	return newRepoAction(x, u, repo)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func transferRepoAction(e Engine, u, newUser *User, repo *Repository) (err error) {
 | 
			
		||||
	action := &Action{
 | 
			
		||||
		ActUserId:    u.Id,
 | 
			
		||||
		ActUserName:  u.Name,
 | 
			
		||||
@@ -438,20 +446,24 @@ func TransferRepoAction(u, newUser *User, repo *Repository) (err error) {
 | 
			
		||||
		IsPrivate:    repo.IsPrivate,
 | 
			
		||||
		Content:      path.Join(repo.Owner.LowerName, repo.LowerName),
 | 
			
		||||
	}
 | 
			
		||||
	if err = NotifyWatchers(action); err != nil {
 | 
			
		||||
		log.Error(4, "NotifyWatchers: %d/%s", u.Id, repo.Name)
 | 
			
		||||
		return err
 | 
			
		||||
	if err = notifyWatchers(e, action); err != nil {
 | 
			
		||||
		return fmt.Errorf("notify watchers '%d/%s'", u.Id, repo.Id)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Remove watch for organization.
 | 
			
		||||
	if repo.Owner.IsOrganization() {
 | 
			
		||||
		if err = WatchRepo(repo.Owner.Id, repo.Id, false); err != nil {
 | 
			
		||||
			log.Error(4, "WatchRepo", err)
 | 
			
		||||
		if err = watchRepo(e, repo.Owner.Id, repo.Id, false); err != nil {
 | 
			
		||||
			return fmt.Errorf("watch repository: %v", err)
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	log.Trace("action.TransferRepoAction: %s/%s", u.Name, repo.Name)
 | 
			
		||||
	return err
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// TransferRepoAction adds new action for transferring repository.
 | 
			
		||||
func TransferRepoAction(u, newUser *User, repo *Repository) (err error) {
 | 
			
		||||
	return transferRepoAction(x, u, newUser, repo)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// GetFeeds returns action list of given user in given context.
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user