BigW Consortium Gitlab

Commit 5fb436aa by Rémy Coutable

Fix a few nitpicks

Signed-off-by: 's avatarRémy Coutable <remy@rymai.me>
parent 4d69cb9d
......@@ -372,8 +372,8 @@ class Ability
]
end
if (group.public? || (group.internal? && !user.external?)) && group.request_access_enabled
rules << :request_access unless group.users.include?(user)
if group.public? || (group.internal? && !user.external?)
rules << :request_access if group.request_access_enabled && group.users.exclude?(user)
end
rules.flatten
......
......@@ -90,8 +90,8 @@ GitLab account using the same e-mail address the invitation was sent to.
## Request access to a project
As project owner you can enable or disable non members to request access to
your project. Go to project settings and click on **allow users to request access**
As a project owner you can enable or disable non members to request access to
your project. Go to the project settings and click on **Allow users to request access**.
As a user, you can request to be a member of a project. Go to the project you'd
like to be a member of, and click the **Request Access** button on the right
......
......@@ -53,8 +53,8 @@ If necessary, you can increase the access level of an individual user for a spec
## Requesting access to a group
As group owner you can enable or disable non members to request access to
your group. Go to group settings and click on **allow users to request access**
As a group owner you can enable or disable non members to request access to
your group. Go to the group settings and click on **Allow users to request access**.
As a user, you can request to be a member of a group. Go to the group you'd
like to be a member of, and click the **Request Access** button on the right
......
......@@ -9,19 +9,17 @@ feature 'Groups > Members > User requests access', feature: true do
background do
group.add_owner(owner)
login_as(user)
visit group_path(group)
end
scenario 'request access feature is disabled' do
group.update_attributes(request_access_enabled: false)
visit group_path(group)
visit group_path(group)
expect(page).not_to have_content 'Request Access'
end
scenario 'user can request access to a group' do
visit group_path(group)
perform_enqueued_jobs { click_link 'Request Access' }
expect(ActionMailer::Base.deliveries.last.to).to eq [owner.notification_email]
......@@ -35,15 +33,12 @@ feature 'Groups > Members > User requests access', feature: true do
end
scenario 'user does not see private projects' do
visit group_path(group)
perform_enqueued_jobs { click_link 'Request Access' }
expect(page).not_to have_content project.name
end
scenario 'user does not see group in the Dashboard > Groups page' do
visit group_path(group)
perform_enqueued_jobs { click_link 'Request Access' }
visit dashboard_groups_path
......@@ -52,8 +47,6 @@ feature 'Groups > Members > User requests access', feature: true do
end
scenario 'user is not listed in the group members page' do
visit group_path(group)
click_link 'Request Access'
expect(group.requesters.exists?(user_id: user)).to be_truthy
......@@ -66,8 +59,6 @@ feature 'Groups > Members > User requests access', feature: true do
end
scenario 'user can withdraw its request for access' do
visit group_path(group)
click_link 'Request Access'
expect(group.requesters.exists?(user_id: user)).to be_truthy
......
......@@ -8,17 +8,17 @@ feature 'Projects > Members > User requests access', feature: true do
background do
project.team << [master, :master]
login_as(user)
visit namespace_project_path(project.namespace, project)
end
scenario 'request access feature is disabled' do
project.update_attributes(request_access_enabled: false)
visit namespace_project_path(project.namespace, project)
expect(page).not_to have_content 'Request Access'
end
scenario 'user can request access to a project' do
visit namespace_project_path(project.namespace, project)
perform_enqueued_jobs { click_link 'Request Access' }
expect(ActionMailer::Base.deliveries.last.to).to eq [master.notification_email]
......@@ -32,7 +32,6 @@ feature 'Projects > Members > User requests access', feature: true do
end
scenario 'user is not listed in the project members page' do
visit namespace_project_path(project.namespace, project)
click_link 'Request Access'
expect(project.requesters.exists?(user_id: user)).to be_truthy
......@@ -47,7 +46,6 @@ feature 'Projects > Members > User requests access', feature: true do
end
scenario 'user can withdraw its request for access' do
visit namespace_project_path(project.namespace, project)
click_link 'Request Access'
expect(project.requesters.exists?(user_id: user)).to be_truthy
......
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