-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Fix error when add user has full name to team #2973
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2973 +/- ##
=========================================
- Coverage 26.82% 26.8% -0.02%
=========================================
Files 90 90
Lines 17807 17807
=========================================
- Hits 4777 4774 -3
- Misses 12351 12353 +2
- Partials 679 680 +1
Continue to review full report at Codecov.
|
routers/org/teams.go
Outdated
@@ -76,6 +77,9 @@ func TeamsAction(ctx *context.Context) { | |||
return | |||
} | |||
uname := ctx.Query("uname") | |||
if strings.Contains(uname, "(") && strings.HasSuffix(uname, ")") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm confused as to why this helps. If uname
has parentheses, then it is not a valid username, so GetUserByName(name)
in line 84 will just return a ErrUserNotExist
, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ethantkoenig Yes, that's what #2973 described.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because if some user has set FullName
, the name submitted will be loginname (FullName)
but not loginname
, so it will return ErrUserNotExist. This PR will accept both two kinds requests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I see. Could we please add a comment explaining the situation?
// uname may be formatted as "username (fullname)"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
LGTM |
LGTM |
* fix error when add user has full name to team * add comment for extra uname check
also fixed #2726 |
Will fix #2962.