Commit b2dc9176 authored by Rémy Coutable's avatar Rémy Coutable

Group owner cannot request access to a project of their group

Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent f011b86b
- member = source.members.find_by(user_id: current_user.id) - member = source.members.find_by(user_id: current_user.id)
- group_member = source.group.members.find_by(user_id: current_user.id) if source.try(:group)
- if member - unless group_member
- if member
- if member.request? - if member.request?
= link_to 'Withdraw Access Request', polymorphic_path([:leave, source, :members]), = link_to 'Withdraw Access Request', polymorphic_path([:leave, source, :members]),
method: :delete, method: :delete,
data: { confirm: remove_member_message(member) }, data: { confirm: remove_member_message(member) },
class: 'btn access-request-button hidden-xs' class: 'btn access-request-button hidden-xs'
- else - else
= link_to 'Request Access', polymorphic_path([:request_access, source, :members]), = link_to 'Request Access', polymorphic_path([:request_access, source, :members]),
method: :post, method: :post,
class: 'btn access-request-button hidden-xs' class: 'btn access-request-button hidden-xs'
require 'spec_helper'
feature 'Projects > Members > Group owner cannot request access to his group project', feature: true do
let(:owner) { create(:user) }
let(:group) { create(:group) }
let(:project) { create(:project, namespace: group) }
background do
group.add_owner(owner)
login_as(owner)
visit namespace_project_path(project.namespace, project)
end
scenario 'owner does not see the request access button' do
expect(page).not_to have_content 'Request Access'
end
end
require 'spec_helper'
feature 'Projects > Members > Group requester cannot request access to project', feature: true do
let(:user) { create(:user) }
let(:owner) { create(:user) }
let(:group) { create(:group, :public) }
let(:project) { create(:project, :public, namespace: group) }
background do
group.add_owner(owner)
login_as(user)
visit group_path(group)
perform_enqueued_jobs { click_link 'Request Access' }
visit namespace_project_path(project.namespace, project)
end
scenario 'group requester does not see the request access / withdraw access request button' do
expect(page).not_to have_content 'Request Access'
expect(page).not_to have_content 'Withdraw Access Request'
end
end
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