From 5f6c6d6a0d8feee9b17d309e4da180dce7ca8ce0 Mon Sep 17 00:00:00 2001 From: Douglas Barbosa Alexandre <dbalexandre@gmail.com> Date: Wed, 17 Aug 2016 16:04:08 -0300 Subject: [PATCH] Hide `Create new list button` on Issues and MRs pages --- app/views/shared/issuable/_filter.html.haml | 6 +++--- spec/features/projects/issues/list_spec.rb | 20 +++++++++++++++++++ .../projects/merge_requests/list_spec.rb | 20 +++++++++++++++++++ 3 files changed, 43 insertions(+), 3 deletions(-) create mode 100644 spec/features/projects/issues/list_spec.rb create mode 100644 spec/features/projects/merge_requests/list_spec.rb diff --git a/app/views/shared/issuable/_filter.html.haml b/app/views/shared/issuable/_filter.html.haml index ffe8d4fbdbf..4f8ea7e7cef 100644 --- a/app/views/shared/issuable/_filter.html.haml +++ b/app/views/shared/issuable/_filter.html.haml @@ -27,9 +27,7 @@ = render "shared/issuable/label_dropdown" .pull-right - - if controller.controller_name != 'boards' - = render 'shared/sort_dropdown' - - if can?(current_user, :admin_list, @project) + - if controller.controller_name == 'boards' && can?(current_user, :admin_list, @project) .dropdown %button.btn.btn-create.js-new-board-list{ type: "button", data: { toggle: "dropdown", labels: labels_filter_path, project_id: @project.try(:id) } } Create new list @@ -38,6 +36,8 @@ - if can?(current_user, :admin_label, @project) = render partial: "shared/issuable/label_page_create" = dropdown_loading + - else + = render 'shared/sort_dropdown' - if controller.controller_name == 'issues' .issues_bulk_update.hide diff --git a/spec/features/projects/issues/list_spec.rb b/spec/features/projects/issues/list_spec.rb new file mode 100644 index 00000000000..3137af074ca --- /dev/null +++ b/spec/features/projects/issues/list_spec.rb @@ -0,0 +1,20 @@ +require 'spec_helper' + +feature 'Issues List' do + let(:user) { create(:user) } + let(:project) { create(:empty_project) } + + background do + project.team << [user, :developer] + + login_as(user) + end + + scenario 'user does not see create new list button' do + create(:issue, project: project) + + visit namespace_project_issues_path(project.namespace, project) + + expect(page).not_to have_selector('.js-new-board-list') + end +end diff --git a/spec/features/projects/merge_requests/list_spec.rb b/spec/features/projects/merge_requests/list_spec.rb new file mode 100644 index 00000000000..5dd58ad66a7 --- /dev/null +++ b/spec/features/projects/merge_requests/list_spec.rb @@ -0,0 +1,20 @@ +require 'spec_helper' + +feature 'Merge Requests List' do + let(:user) { create(:user) } + let(:project) { create(:project) } + + background do + project.team << [user, :developer] + + login_as(user) + end + + scenario 'user does not see create new list button' do + create(:merge_request, source_project: project) + + visit namespace_project_merge_requests_path(project.namespace, project) + + expect(page).not_to have_selector('.js-new-board-list') + end +end -- GitLab