diff options
author | Sasha Varlamov <sasha@sashavarlamov.com> | 2017-12-07 14:00:09 +0700 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2017-12-07 15:00:09 +0800 |
commit | 311c83ad17c718f1b81c94f84307b4288c90e374 (patch) | |
tree | a2d962fdeb7637d5f02351abac58584eb0ef90ec /routers/org | |
parent | 7ec6cddd27f36f50f06669b208674feb0dc19535 (diff) | |
download | gitea-311c83ad17c718f1b81c94f84307b4288c90e374.tar.gz gitea-311c83ad17c718f1b81c94f84307b4288c90e374.zip |
Allow adding collaborators with (fullname) (#3103)
* Allow adding collaborators with (fullname)
Signed-off-by: Sasha Varlamov <sasha@sashavarlamov.com>
* Refactor username suffix to utils pkg
Signed-off-by: Sasha Varlamov <sasha@sashavarlamov.com>
Diffstat (limited to 'routers/org')
-rw-r--r-- | routers/org/teams.go | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/routers/org/teams.go b/routers/org/teams.go index e9abfe7917..7f8b828e82 100644 --- a/routers/org/teams.go +++ b/routers/org/teams.go @@ -15,6 +15,7 @@ import ( "code.gitea.io/gitea/modules/base" "code.gitea.io/gitea/modules/context" "code.gitea.io/gitea/modules/log" + "code.gitea.io/gitea/routers/utils" ) const ( @@ -76,11 +77,7 @@ func TeamsAction(ctx *context.Context) { ctx.Error(404) return } - uname := ctx.Query("uname") - // uname may be formatted as "username (fullname)" - if strings.Contains(uname, "(") && strings.HasSuffix(uname, ")") { - uname = strings.TrimSpace(strings.Split(uname, "(")[0]) - } + uname := utils.RemoveUsernameParameterSuffix(strings.ToLower(ctx.Query("uname"))) var u *models.User u, err = models.GetUserByName(uname) if err != nil { |