mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 11:35:03 +01:00 
			
		
		
		
	Change user name in Pull Requests
This commit is contained in:
		
							parent
							
								
									93f40995b3
								
							
						
					
					
						commit
						674c5c37be
					
				| @ -525,6 +525,14 @@ func AddTestPullRequestTask(repoID int64, branch string) { | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| func ChangeUsernameInPullRequests(oldUserName, newUserName string) (error) { | ||||
| 	pr := PullRequest{ | ||||
| 		HeadUserName : newUserName, | ||||
| 	} | ||||
| 	_, err := x.Cols("head_user_name").Where("head_user_name = ?", oldUserName).Update(pr) | ||||
| 	return err | ||||
| } | ||||
| 
 | ||||
| // checkAndUpdateStatus checks if pull request is possible to levaing checking status, | ||||
| // and set to be either conflict or mergeable. | ||||
| func (pr *PullRequest) checkAndUpdateStatus() { | ||||
|  | ||||
| @ -599,6 +599,11 @@ func ChangeUserName(u *User, newUserName string) (err error) { | ||||
| 		return ErrUserAlreadyExist{newUserName} | ||||
| 	} | ||||
| 
 | ||||
| 	err = ChangeUsernameInPullRequests(u.LowerName, newUserName) | ||||
| 	if err != nil { | ||||
| 		return err | ||||
| 	} | ||||
| 
 | ||||
| 	return os.Rename(UserPath(u.LowerName), UserPath(newUserName)) | ||||
| } | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user