rename a user method
This commit is contained in:
parent
c08600c59b
commit
b900863d60
2 changed files with 9 additions and 16 deletions
|
@ -133,6 +133,7 @@ func (a Action) GetIssueInfos() []string {
|
||||||
return strings.SplitN(a.Content, "|", 2)
|
return strings.SplitN(a.Content, "|", 2)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// updateIssuesCommit checks if issues are manipulated by commit message.
|
||||||
func updateIssuesCommit(u *User, repo *Repository, repoUserName, repoName string, commits []*base.PushCommit) error {
|
func updateIssuesCommit(u *User, repo *Repository, repoUserName, repoName string, commits []*base.PushCommit) error {
|
||||||
for _, c := range commits {
|
for _, c := range commits {
|
||||||
for _, ref := range IssueReferenceKeywordsPat.FindAllString(c.Message, -1) {
|
for _, ref := range IssueReferenceKeywordsPat.FindAllString(c.Message, -1) {
|
||||||
|
@ -376,7 +377,7 @@ func CommitRepoAction(userID, repoUserID int64, userName, actEmail string,
|
||||||
pusher, err := GetUserByName(userName)
|
pusher, err := GetUserByName(userName)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
pusher_email = pusher.Email
|
pusher_email = pusher.Email
|
||||||
pusher_name = pusher.GetFullNameFallback()
|
pusher_name = pusher.DisplayName()
|
||||||
}
|
}
|
||||||
|
|
||||||
commits := make([]*PayloadCommit, len(commit.Commits))
|
commits := make([]*PayloadCommit, len(commit.Commits))
|
||||||
|
@ -408,7 +409,7 @@ func CommitRepoAction(userID, repoUserID int64, userName, actEmail string,
|
||||||
Website: repo.Website,
|
Website: repo.Website,
|
||||||
Watchers: repo.NumWatches,
|
Watchers: repo.NumWatches,
|
||||||
Owner: &PayloadAuthor{
|
Owner: &PayloadAuthor{
|
||||||
Name: repo.Owner.GetFullNameFallback(),
|
Name: repo.Owner.DisplayName(),
|
||||||
Email: repo.Owner.Email,
|
Email: repo.Owner.Email,
|
||||||
UserName: repo.Owner.Name,
|
UserName: repo.Owner.Name,
|
||||||
},
|
},
|
||||||
|
|
|
@ -165,15 +165,6 @@ func (u *User) AvatarLink() string {
|
||||||
return setting.GravatarSource + u.Avatar
|
return setting.GravatarSource + u.Avatar
|
||||||
}
|
}
|
||||||
|
|
||||||
// DisplayName returns full name if it's not empty,
|
|
||||||
// returns username otherwise.
|
|
||||||
func (u *User) DisplayName() string {
|
|
||||||
if len(u.FullName) > 0 {
|
|
||||||
return u.FullName
|
|
||||||
}
|
|
||||||
return u.Name
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewGitSig generates and returns the signature of given user.
|
// NewGitSig generates and returns the signature of given user.
|
||||||
func (u *User) NewGitSig() *git.Signature {
|
func (u *User) NewGitSig() *git.Signature {
|
||||||
return &git.Signature{
|
return &git.Signature{
|
||||||
|
@ -300,12 +291,13 @@ func (u *User) GetOrganizations() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetFullNameFallback returns Full Name if set, otherwise username
|
// DisplayName returns full name if it's not empty,
|
||||||
func (u *User) GetFullNameFallback() string {
|
// returns username otherwise.
|
||||||
if u.FullName == "" {
|
func (u *User) DisplayName() string {
|
||||||
return u.Name
|
if len(u.FullName) > 0 {
|
||||||
}
|
|
||||||
return u.FullName
|
return u.FullName
|
||||||
|
}
|
||||||
|
return u.Name
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsUserExist checks if given user name exist,
|
// IsUserExist checks if given user name exist,
|
||||||
|
|
Loading…
Reference in a new issue