diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2016-12-09 13:28:42 +0000 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2016-12-09 13:28:42 +0000 |
commit | b026e8cd88a3345c8c8fdb25bb12465d520939f6 (patch) | |
tree | 56f2bb1d8bf9800161fa6e4e037ef3aa813f38d4 | |
parent | 1f9d688ffcc091d2b7167e6e51a070c1271823ce (diff) | |
parent | 4af62042bb7ddeff742a62048438673811e5344a (diff) | |
download | gitlab-ce-b026e8cd88a3345c8c8fdb25bb12465d520939f6.tar.gz |
Merge branch '25272_fix_comments_tab_disappearing' into 'master'
Fix comments tab disappearing
Fixes #25272
See merge request !7913
-rw-r--r-- | app/helpers/events_helper.rb | 6 | ||||
-rw-r--r-- | app/views/shared/_event_filter.html.haml | 2 | ||||
-rw-r--r-- | changelogs/unreleased/25272_fix_comments_tab_disappearing.yml | 4 | ||||
-rw-r--r-- | spec/features/projects/features_visibility_spec.rb | 38 |
4 files changed, 49 insertions, 1 deletions
diff --git a/app/helpers/events_helper.rb b/app/helpers/events_helper.rb index f1a0b929d82..362046c0270 100644 --- a/app/helpers/events_helper.rb +++ b/app/helpers/events_helper.rb @@ -45,6 +45,12 @@ module EventsHelper @project.feature_available?(feature_key, current_user) end + def comments_visible? + event_filter_visible(:repository) || + event_filter_visible(:merge_requests) || + event_filter_visible(:issues) + end + def event_preposition(event) if event.push? || event.commented? || event.target "at" diff --git a/app/views/shared/_event_filter.html.haml b/app/views/shared/_event_filter.html.haml index 67c145cef17..e50ab5fea09 100644 --- a/app/views/shared/_event_filter.html.haml +++ b/app/views/shared/_event_filter.html.haml @@ -6,6 +6,6 @@ = event_filter_link EventFilter.merged, 'Merge events' - if event_filter_visible(:issues) = event_filter_link EventFilter.issue, 'Issue events' - - if event_filter_visible(:issues) + - if comments_visible? = event_filter_link EventFilter.comments, 'Comments' = event_filter_link EventFilter.team, 'Team' diff --git a/changelogs/unreleased/25272_fix_comments_tab_disappearing.yml b/changelogs/unreleased/25272_fix_comments_tab_disappearing.yml new file mode 100644 index 00000000000..79cb2c6d843 --- /dev/null +++ b/changelogs/unreleased/25272_fix_comments_tab_disappearing.yml @@ -0,0 +1,4 @@ +--- +title: 'Fix comments activity tab visibility condition' +merge_request: 7913 +author: Rydkin Maxim diff --git a/spec/features/projects/features_visibility_spec.rb b/spec/features/projects/features_visibility_spec.rb index 09aa6758b5c..3bb33394be7 100644 --- a/spec/features/projects/features_visibility_spec.rb +++ b/spec/features/projects/features_visibility_spec.rb @@ -182,6 +182,44 @@ describe 'Edit Project Settings', feature: true do expect(page).not_to have_content("Comments") end end + + # Regression spec for https://gitlab.com/gitlab-org/gitlab-ce/issues/25272 + it "hides comments activity tab only on disabled issues, merge requests and repository" do + select "Disabled", from: "project_project_feature_attributes_issues_access_level" + + save_changes_and_check_activity_tab do + expect(page).to have_content("Comments") + end + + visit edit_namespace_project_path(project.namespace, project) + + select "Disabled", from: "project_project_feature_attributes_merge_requests_access_level" + + save_changes_and_check_activity_tab do + expect(page).to have_content("Comments") + end + + visit edit_namespace_project_path(project.namespace, project) + + select "Disabled", from: "project_project_feature_attributes_repository_access_level" + + save_changes_and_check_activity_tab do + expect(page).not_to have_content("Comments") + end + + visit edit_namespace_project_path(project.namespace, project) + end + + def save_changes_and_check_activity_tab + click_button "Save changes" + wait_for_ajax + + visit activity_namespace_project_path(project.namespace, project) + + page.within(".event-filter") do + yield + end + end end # Regression spec for https://gitlab.com/gitlab-org/gitlab-ce/issues/24056 |