Skip to content

Commit a6cdda1

Browse files
adelowolafriks
authored andcommitted
Display error when adding a user to a team twice (#4746)
1 parent b1ad573 commit a6cdda1

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

options/locale/locale_en-US.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1312,6 +1312,7 @@ teams.search_repo_placeholder = Search repository…
13121312
teams.add_team_repository = Add Team Repository
13131313
teams.remove_repo = Remove
13141314
teams.add_nonexistent_repo = "The repository you're trying to add does not exist; please create it first."
1315+
teams.add_duplicate_users = User is already a team member.
13151316

13161317
[admin]
13171318
dashboard = Dashboard

routers/org/teams.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,12 @@ func TeamsAction(ctx *context.Context) {
9696
return
9797
}
9898

99-
err = ctx.Org.Team.AddMember(u.ID)
99+
if ctx.Org.Team.IsMember(u.ID) {
100+
ctx.Flash.Error(ctx.Tr("org.teams.add_duplicate_users"))
101+
} else {
102+
err = ctx.Org.Team.AddMember(u.ID)
103+
}
104+
100105
page = "team"
101106
}
102107

0 commit comments

Comments
 (0)