Browse Source

Remove direct user adding to organization members (#2641)

Lauris BH 2 years ago
parent
commit
32ca299650

+ 0 - 2
options/locale/locale_en-US.ini

@@ -274,7 +274,6 @@ enterred_invalid_password = Please ensure the that password you entered is corre
274 274
 user_not_exist = The user does not exist.
275 275
 last_org_owner = Removing the last user from the owner team is not allowed because there must always be at least one owner in any given organization.
276 276
 cannot_add_org_to_team = Organization cannot be added as a team member.
277
-cannot_invite_org_to_org = Organization cannot be invited as an organization member.
278 277
 
279 278
 invalid_ssh_key = Sorry, we were not able to verify your SSH key: %s
280 279
 invalid_gpg_key = Sorry, we were not able to verify your GPG key: %s
@@ -1070,7 +1069,6 @@ org_name_helper = Great organization names are short and memorable.
1070 1069
 create_org = Create Organization
1071 1070
 repo_updated = Updated
1072 1071
 people = People
1073
-invite_someone = Invite Someone
1074 1072
 teams = Teams
1075 1073
 lower_members = members
1076 1074
 lower_repositories = repositories

+ 0 - 40
routers/org/members.go

@@ -17,8 +17,6 @@ import (
17 17
 const (
18 18
 	// tplMembers template for organization members page
19 19
 	tplMembers base.TplName = "org/member/members"
20
-	// tplMemberInvite template for orgnization invite page
21
-	tplMemberInvite base.TplName = "org/member/invite"
22 20
 )
23 21
 
24 22
 // Members render orgnization users page
@@ -94,41 +92,3 @@ func MembersAction(ctx *context.Context) {
94 92
 		ctx.Redirect(setting.AppSubURL + "/")
95 93
 	}
96 94
 }
97
-
98
-// Invitation render organization invitation page
99
-func Invitation(ctx *context.Context) {
100
-	org := ctx.Org.Organization
101
-	ctx.Data["Title"] = org.FullName
102
-	ctx.Data["PageIsOrgMembers"] = true
103
-
104
-	if ctx.Req.Method == "POST" {
105
-		uname := ctx.Query("uname")
106
-		u, err := models.GetUserByName(uname)
107
-		if err != nil {
108
-			if models.IsErrUserNotExist(err) {
109
-				ctx.Flash.Error(ctx.Tr("form.user_not_exist"))
110
-				ctx.Redirect(ctx.Org.OrgLink + "/invitations/new")
111
-			} else {
112
-				ctx.Handle(500, " GetUserByName", err)
113
-			}
114
-			return
115
-		}
116
-
117
-		if u.IsOrganization() {
118
-			ctx.Flash.Error(ctx.Tr("form.cannot_invite_org_to_org"))
119
-			ctx.Redirect(ctx.Org.OrgLink + "/invitations/new")
120
-			return
121
-		}
122
-
123
-		if err = org.AddMember(u.ID); err != nil {
124
-			ctx.Handle(500, " AddMember", err)
125
-			return
126
-		}
127
-
128
-		log.Trace("New member added(%s): %s", org.Name, u.Name)
129
-		ctx.Redirect(ctx.Org.OrgLink + "/members")
130
-		return
131
-	}
132
-
133
-	ctx.HTML(200, tplMemberInvite)
134
-}

+ 0 - 2
routers/routes/routes.go

@@ -407,8 +407,6 @@ func RegisterRoutes(m *macaron.Macaron) {
407 407
 
408 408
 				m.Route("/delete", "GET,POST", org.SettingsDelete)
409 409
 			})
410
-
411
-			m.Route("/invitations/new", "GET,POST", org.Invitation)
412 410
 		}, context.OrgAssignment(true, true))
413 411
 	}, reqSignIn)
414 412
 	// ***** END: Organization *****

+ 0 - 5
templates/org/home.tmpl

@@ -52,11 +52,6 @@
52 52
 						{{end}}
53 53
 					{{end}}
54 54
 				</div>
55
-				{{if .IsOrganizationOwner}}
56
-					<div class="ui bottom attached segment">
57
-						<a class="ui blue small button" href="{{.OrgLink}}/invitations/new">{{.i18n.Tr "org.invite_someone"}}</a>
58
-					</div>
59
-				{{end}}
60 55
 
61 56
 				{{if .IsOrganizationMember}}
62 57
 					<div class="ui top attached header">

+ 0 - 22
templates/org/member/invite.tmpl

@@ -1,22 +0,0 @@
1
-{{template "base/head" .}}
2
-<div class="organization invite">
3
-	{{template "org/header" .}}
4
-	<div class="ui container">
5
-		<div id="invite-box">
6
-			{{template "base/alert" .}}
7
-			<h2>{{.i18n.Tr "org.members.invite_desc" .Org.DisplayName}}</h2>
8
-			<form class="ui form" action="{{.Link}}" method="post">
9
-				{{.CsrfTokenHtml}}
10
-				<div class="inline field ui left">
11
-					<div id="search-user-box" class="ui search">
12
-						<div class="ui input">
13
-							<input class="prompt" name="uname" placeholder="{{.i18n.Tr "repo.settings.search_user_placeholder"}}" autocomplete="off" autofocus required>
14
-						</div>
15
-					</div>
16
-				</div>
17
-				<button class="ui blue button">{{.i18n.Tr "org.members.invite_now"}}</button>
18
-			</form>
19
-		</div>
20
-	</div>
21
-</div>
22
-{{template "base/footer" .}}

+ 0 - 6
templates/org/member/members.tmpl

@@ -3,12 +3,6 @@
3 3
 	{{template "org/header" .}}
4 4
 	<div class="ui container">
5 5
 		{{template "base/alert" .}}
6
-		{{if .IsOrganizationOwner}}
7
-			<div class="text right">
8
-				<a class="ui blue button" href="{{.OrgLink}}/invitations/new"><i class="octicon octicon-repo-create"></i> {{.i18n.Tr "org.invite_someone"}}</a>
9
-			</div>
10
-			<div class="ui divider"></div>
11
-		{{end}}
12 6
 
13 7
 		<div class="list">
14 8
 			{{range .Members}}