summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-08-27 13:26:38 +0800
committerUnknwon <u@gogs.io>2015-08-27 13:26:38 +0800
commitb900863d60a79ab80327dab828138b7f79615d25 (patch)
tree3aafa96291d998a5e63b07e92e8ef0fe0c1c08e9
parentc08600c59b8fb8d5f03fadacddb1140bc994ae94 (diff)
downloadgitea-b900863d60a79ab80327dab828138b7f79615d25.tar.gz
gitea-b900863d60a79ab80327dab828138b7f79615d25.zip
rename a user method
-rw-r--r--models/action.go5
-rw-r--r--models/user.go20
2 files changed, 9 insertions, 16 deletions
diff --git a/models/action.go b/models/action.go
index 8405084bbe..1ab38893b0 100644
--- a/models/action.go
+++ b/models/action.go
@@ -133,6 +133,7 @@ func (a Action) GetIssueInfos() []string {
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 {
for _, c := range commits {
for _, ref := range IssueReferenceKeywordsPat.FindAllString(c.Message, -1) {
@@ -376,7 +377,7 @@ func CommitRepoAction(userID, repoUserID int64, userName, actEmail string,
pusher, err := GetUserByName(userName)
if err == nil {
pusher_email = pusher.Email
- pusher_name = pusher.GetFullNameFallback()
+ pusher_name = pusher.DisplayName()
}
commits := make([]*PayloadCommit, len(commit.Commits))
@@ -408,7 +409,7 @@ func CommitRepoAction(userID, repoUserID int64, userName, actEmail string,
Website: repo.Website,
Watchers: repo.NumWatches,
Owner: &PayloadAuthor{
- Name: repo.Owner.GetFullNameFallback(),
+ Name: repo.Owner.DisplayName(),
Email: repo.Owner.Email,
UserName: repo.Owner.Name,
},
diff --git a/models/user.go b/models/user.go
index 3d54b79e76..1935799041 100644
--- a/models/user.go
+++ b/models/user.go
@@ -165,15 +165,6 @@ func (u *User) AvatarLink() string {
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.
func (u *User) NewGitSig() *git.Signature {
return &git.Signature{
@@ -300,12 +291,13 @@ func (u *User) GetOrganizations() error {
return nil
}
-// GetFullNameFallback returns Full Name if set, otherwise username
-func (u *User) GetFullNameFallback() string {
- if u.FullName == "" {
- return u.Name
+// 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.FullName
+ return u.Name
}
// IsUserExist checks if given user name exist,