Commit 453340d4 authored by Douwe Maan's avatar Douwe Maan

Let membership invitations be resent.

parent 87dd3f21
......@@ -47,6 +47,17 @@ class Groups::GroupMembersController < Groups::ApplicationController
end
end
def resend_invite
@group_member = @group.group_members.find(params[:id])
if @group_member.invite?
@group_member.resend_invite
redirect_to group_group_members_path(@group), notice: 'Invite was successfully resent.'
else
redirect_to group_group_members_path(@group), alert: 'The invite has already been accepted.'
end
end
def leave
@group_member = @group.group_members.where(user_id: current_user.id).first
......
......@@ -59,6 +59,19 @@ class Projects::ProjectMembersController < Projects::ApplicationController
end
end
def resend_invite
@project_member = @project.project_members.find(params[:id])
if @project_member.invite?
@project_member.resend_invite
redirect_to namespace_project_project_members_path(@project.namespace,
@project), notice: 'Invite was successfully resent.'
else
redirect_to namespace_project_project_members_path(@project.namespace,
@project), alert: 'The invite has already been accepted.'
end
end
def leave
@project.project_members.find_by(user_id: current_user).destroy
......
......@@ -24,6 +24,10 @@
= link_to member.created_by.name, user_path(member.created_by)
= time_ago_with_tooltip(member.created_at)
- if show_controls && can?(current_user, :admin_group, @group)
= link_to resend_invite_group_group_member_path(@group, member), method: :post, class: "btn-xs btn", title: 'Resend invite' do
Resend invite
- if show_roles
%span.pull-right
%strong= member.human_access
......
......@@ -24,6 +24,10 @@
= link_to member.created_by.name, user_path(member.created_by)
= time_ago_with_tooltip(member.created_at)
- if current_user_can_admin_project
= link_to resend_invite_namespace_project_project_member_path(@project.namespace, @project, member), method: :post, class: "btn-xs btn", title: 'Resend invite' do
Resend invite
- if current_user_can_admin_project
- unless @project.personal? && user == current_user
.pull-right
......
......@@ -260,6 +260,7 @@ Gitlab::Application.routes.draw do
scope module: :groups do
resources :group_members, only: [:index, :create, :update, :destroy] do
post :resend_invite, on: :member
delete :leave, on: :collection
end
......@@ -486,6 +487,10 @@ Gitlab::Application.routes.draw do
get :import
post :apply_import
end
member do
post :resend_invite
end
end
resources :notes, only: [:index, :create, :destroy, :update], constraints: { id: /\d+/ } do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment