Commit bd0bd8cc authored by Fatih Acet's avatar Fatih Acet

Merge branch 'project-activity-tabs-hide' into 'master'

Hide project activity tabs when features are disabled

## What does this MR do?

When features are disabled in project settings, the activity tabs are now correctly hidden.

## Screenshots (if relevant)

![Screen_Shot_2016-10-21_at_12.15.27](/uploads/3d85c027aa05487001c8abd624a99be0/Screen_Shot_2016-10-21_at_12.15.27.png)

## What are the relevant issue numbers?

https://gitlab.com/gitlab-org/gitlab-ce/issues/19734#note_17224181

See merge request !7038
parents 7ac41469 e765299f
......@@ -15,6 +15,7 @@ Please view this file on the master branch, on stable branches it's out of date.
- Refactor Jira service to use jira-ruby gem
- Improved todos empty state
- Add hover to trash icon in notes !7008 (blackst0ne)
- Hides project activity tabs when features are disabled
- Only show one error message for an invalid email !5905 (lycoperdon)
- Fix sidekiq stats in admin area (blackst0ne)
- Created cycle analytics bundle JavaScript file
......
......@@ -39,6 +39,12 @@ module EventsHelper
end
end
def event_filter_visible(feature_key)
return true unless @project
@project.feature_available?(feature_key, current_user)
end
def event_preposition(event)
if event.push? || event.commented? || event.target
"at"
......
%ul.nav-links.event-filter.scrolling-tabs
= event_filter_link EventFilter.all, 'All'
= event_filter_link EventFilter.push, 'Push events'
= event_filter_link EventFilter.merged, 'Merge events'
= event_filter_link EventFilter.comments, 'Comments'
- if event_filter_visible(:repository)
= event_filter_link EventFilter.push, 'Push events'
- if event_filter_visible(:merge_requests)
= event_filter_link EventFilter.merged, 'Merge events'
- if event_filter_visible(:issues)
= event_filter_link EventFilter.comments, 'Comments'
= event_filter_link EventFilter.team, 'Team'
......@@ -164,5 +164,23 @@ describe 'Edit Project Settings', feature: true do
expect(page).to have_content "Customize your workflow!"
end
it "hides project activity tabs" do
select "Disabled", from: "project_project_feature_attributes_repository_access_level"
select "Disabled", from: "project_project_feature_attributes_issues_access_level"
select "Disabled", from: "project_project_feature_attributes_wiki_access_level"
click_button "Save changes"
wait_for_ajax
visit activity_namespace_project_path(project.namespace, project)
page.within(".event-filter") do
expect(page).to have_selector("a", count: 2)
expect(page).not_to have_content("Push events")
expect(page).not_to have_content("Merge events")
expect(page).not_to have_content("Comments")
end
end
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