From 32ca299650277829b93994eca1508f9d84a5b667 Mon Sep 17 00:00:00 2001 From: Lauris BH Date: Sun, 15 Oct 2017 05:24:24 +0300 Subject: [PATCH] Remove direct user adding to organization members (#2641) --- options/locale/locale_en-US.ini | 2 -- routers/org/members.go | 40 ------------------------------- routers/routes/routes.go | 2 -- templates/org/home.tmpl | 5 ---- templates/org/member/invite.tmpl | 22 ----------------- templates/org/member/members.tmpl | 6 ----- 6 files changed, 77 deletions(-) delete mode 100644 templates/org/member/invite.tmpl diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 9b5bd6dc51..dd9d05c1aa 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -274,7 +274,6 @@ enterred_invalid_password = Please ensure the that password you entered is corre user_not_exist = The user does not exist. 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. cannot_add_org_to_team = Organization cannot be added as a team member. -cannot_invite_org_to_org = Organization cannot be invited as an organization member. invalid_ssh_key = Sorry, we were not able to verify your SSH key: %s 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. create_org = Create Organization repo_updated = Updated people = People -invite_someone = Invite Someone teams = Teams lower_members = members lower_repositories = repositories diff --git a/routers/org/members.go b/routers/org/members.go index 1b74b5f740..aa3646d1e0 100644 --- a/routers/org/members.go +++ b/routers/org/members.go @@ -17,8 +17,6 @@ import ( const ( // tplMembers template for organization members page tplMembers base.TplName = "org/member/members" - // tplMemberInvite template for orgnization invite page - tplMemberInvite base.TplName = "org/member/invite" ) // Members render orgnization users page @@ -94,41 +92,3 @@ func MembersAction(ctx *context.Context) { ctx.Redirect(setting.AppSubURL + "/") } } - -// Invitation render organization invitation page -func Invitation(ctx *context.Context) { - org := ctx.Org.Organization - ctx.Data["Title"] = org.FullName - ctx.Data["PageIsOrgMembers"] = true - - if ctx.Req.Method == "POST" { - uname := ctx.Query("uname") - u, err := models.GetUserByName(uname) - if err != nil { - if models.IsErrUserNotExist(err) { - ctx.Flash.Error(ctx.Tr("form.user_not_exist")) - ctx.Redirect(ctx.Org.OrgLink + "/invitations/new") - } else { - ctx.Handle(500, " GetUserByName", err) - } - return - } - - if u.IsOrganization() { - ctx.Flash.Error(ctx.Tr("form.cannot_invite_org_to_org")) - ctx.Redirect(ctx.Org.OrgLink + "/invitations/new") - return - } - - if err = org.AddMember(u.ID); err != nil { - ctx.Handle(500, " AddMember", err) - return - } - - log.Trace("New member added(%s): %s", org.Name, u.Name) - ctx.Redirect(ctx.Org.OrgLink + "/members") - return - } - - ctx.HTML(200, tplMemberInvite) -} diff --git a/routers/routes/routes.go b/routers/routes/routes.go index e6079445bb..ac71b5eba3 100644 --- a/routers/routes/routes.go +++ b/routers/routes/routes.go @@ -407,8 +407,6 @@ func RegisterRoutes(m *macaron.Macaron) { m.Route("/delete", "GET,POST", org.SettingsDelete) }) - - m.Route("/invitations/new", "GET,POST", org.Invitation) }, context.OrgAssignment(true, true)) }, reqSignIn) // ***** END: Organization ***** diff --git a/templates/org/home.tmpl b/templates/org/home.tmpl index 9b8b311666..18782e3981 100644 --- a/templates/org/home.tmpl +++ b/templates/org/home.tmpl @@ -52,11 +52,6 @@ {{end}} {{end}} - {{if .IsOrganizationOwner}} -
- {{.i18n.Tr "org.invite_someone"}} -
- {{end}} {{if .IsOrganizationMember}}
diff --git a/templates/org/member/invite.tmpl b/templates/org/member/invite.tmpl deleted file mode 100644 index e5d1575939..0000000000 --- a/templates/org/member/invite.tmpl +++ /dev/null @@ -1,22 +0,0 @@ -{{template "base/head" .}} -
- {{template "org/header" .}} -
-
- {{template "base/alert" .}} -

{{.i18n.Tr "org.members.invite_desc" .Org.DisplayName}}

-
- {{.CsrfTokenHtml}} -
- -
- -
-
-
-
-{{template "base/footer" .}} diff --git a/templates/org/member/members.tmpl b/templates/org/member/members.tmpl index d7514d8ba7..e47008c89a 100644 --- a/templates/org/member/members.tmpl +++ b/templates/org/member/members.tmpl @@ -3,12 +3,6 @@ {{template "org/header" .}}
{{template "base/alert" .}} - {{if .IsOrganizationOwner}} - -
- {{end}}
{{range .Members}} -- 2.39.5