summaryrefslogtreecommitdiffstats
path: root/routers/org
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2017-11-26 16:01:48 +0800
committerLauris BH <lauris@nix.lv>2017-11-26 10:01:48 +0200
commit061c501d544002c48fee8b41b5640c0ea1583008 (patch)
tree40e3e931600ded9d3ad74e9396571228b5a9d476 /routers/org
parent16c55e1a5b40c998d76e80d2b8f500db22759288 (diff)
downloadgitea-061c501d544002c48fee8b41b5640c0ea1583008.tar.gz
gitea-061c501d544002c48fee8b41b5640c0ea1583008.zip
Fix error when add user has full name to team (#2973)
* fix error when add user has full name to team * add comment for extra uname check
Diffstat (limited to 'routers/org')
-rw-r--r--routers/org/teams.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/routers/org/teams.go b/routers/org/teams.go
index 1ac4bff2e8..e9abfe7917 100644
--- a/routers/org/teams.go
+++ b/routers/org/teams.go
@@ -6,6 +6,7 @@ package org
import (
"path"
+ "strings"
"github.com/Unknwon/com"
@@ -76,6 +77,10 @@ func TeamsAction(ctx *context.Context) {
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])
+ }
var u *models.User
u, err = models.GetUserByName(uname)
if err != nil {