Commit a3040249 authored by Jonas Wälter's avatar Jonas Wälter Committed by Patrick Bajao

Fix 'New merge request' button

parent 2d558d25
......@@ -2,7 +2,7 @@
- if @merge_requests.present?
= render @merge_requests
- else
= render 'shared/empty_states/merge_requests'
= render 'shared/empty_states/merge_requests', button_path: new_merge_request_path
- if @merge_requests.present?
= paginate_collection @merge_requests, total_pages: @total_pages
......@@ -23,7 +23,7 @@
= render 'shared/issuable/bulk_update_sidebar', type: :merge_requests
.merge-requests-holder
= render 'merge_requests'
= render 'merge_requests', new_merge_request_path: new_merge_request_path
- if new_merge_request_email
.gl-text-center.gl-pt-5.gl-pb-7
.js-issueable-by-email{ data: { initial_email: new_merge_request_email, issuable_type: issuable_type, emails_help_page_path: help_page_path('development/emails', anchor: 'email-namespace'), quick_actions_help_path: help_page_path('user/project/quick_actions'), markdown_help_path: help_page_path('user/markdown'), reset_path: new_issuable_address_project_path(@project, issuable_type: issuable_type) } }
......
......@@ -20,7 +20,7 @@
= _("To widen your search, change or remove filters above")
.text-center
- if can_create_merge_request
= link_to _("New merge request"), project_new_merge_request_path(@project), class: "gl-button btn btn-confirm", title: _("New merge request")
= link_to _("New merge request"), button_path || project_new_merge_request_path(@project), class: "gl-button btn btn-confirm", title: _("New merge request")
- elsif is_opened_state && opened_merged_count == 0 && closed_merged_count > 0
%h4.text-center
= _("There are no open merge requests")
......@@ -28,7 +28,7 @@
= _("To keep this project going, create a new merge request")
.text-center
- if can_create_merge_request
= link_to _("New merge request"), project_new_merge_request_path(@project), class: "gl-button btn btn-confirm", title: _("New merge request")
= link_to _("New merge request"), button_path || project_new_merge_request_path(@project), class: "gl-button btn btn-confirm", title: _("New merge request")
- elsif is_closed_state && opened_merged_count > 0 && closed_merged_count == 0
%h4.text-center
= _("There are no closed merge requests")
......
......@@ -3,6 +3,8 @@
require 'spec_helper'
RSpec.describe 'Merge request > User sees empty state' do
include ProjectForksHelper
let(:project) { create(:project, :public, :repository) }
let(:user) { project.creator }
......@@ -37,4 +39,23 @@ RSpec.describe 'Merge request > User sees empty state' do
expect(page).to have_content('To widen your search, change or remove filters above')
end
end
context 'as member of a fork' do
let(:fork_user) { create(:user) }
let(:forked_project) { fork_project(project, fork_user, namespace: fork_user.namespace, repository: true) }
before do
forked_project.add_maintainer(fork_user)
sign_in(fork_user)
end
it 'shows an empty state and a "New merge request" button' do
visit project_merge_requests_path(project, search: 'foo')
expect(page).to have_selector('.empty-state')
within('.empty-state') do
expect(page).to have_link 'New merge request', href: project_new_merge_request_path(forked_project)
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