Merge branch '39364-in-issue-board-url-doesn-t-take-in-account-hostname-settings' into 'master'
Resolve "In Issue board url doesn't take in account hostname settings" Closes #39364 See merge request gitlab-org/gitlab-ce!15703
This commit is contained in:
commit
483b5f1bfa
5 changed files with 40 additions and 2 deletions
|
@ -20,7 +20,7 @@ class Projects::BoardsController < Projects::ApplicationController
|
|||
private
|
||||
|
||||
def assign_endpoint_vars
|
||||
@boards_endpoint = project_boards_url(project)
|
||||
@boards_endpoint = project_boards_path(project)
|
||||
@bulk_issues_path = bulk_update_project_issues_path(project)
|
||||
@namespace_path = project.namespace.full_path
|
||||
@labels_endpoint = project_labels_path(project)
|
||||
|
|
|
@ -6,7 +6,7 @@ module BoardsHelper
|
|||
def board_data
|
||||
{
|
||||
boards_endpoint: @boards_endpoint,
|
||||
lists_endpoint: board_lists_url(board),
|
||||
lists_endpoint: board_lists_path(board),
|
||||
board_id: board.id,
|
||||
disabled: "#{!can?(current_user, :admin_list, current_board_parent)}",
|
||||
issue_link_base: build_issue_link_base,
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Change boards page boards_data absolute urls to paths
|
||||
merge_request: 15703
|
||||
author:
|
||||
type: fixed
|
|
@ -14,6 +14,12 @@ describe Projects::BoardsController do
|
|||
expect { list_boards }.to change(project.boards, :count).by(1)
|
||||
end
|
||||
|
||||
it 'sets boards_endpoint instance variable to a boards path' do
|
||||
list_boards
|
||||
|
||||
expect(assigns(:boards_endpoint)).to eq project_boards_path(project)
|
||||
end
|
||||
|
||||
context 'when format is HTML' do
|
||||
it 'renders template' do
|
||||
list_boards
|
||||
|
@ -59,6 +65,12 @@ describe Projects::BoardsController do
|
|||
describe 'GET show' do
|
||||
let!(:board) { create(:board, project: project) }
|
||||
|
||||
it 'sets boards_endpoint instance variable to a boards path' do
|
||||
read_board board: board
|
||||
|
||||
expect(assigns(:boards_endpoint)).to eq project_boards_path(project)
|
||||
end
|
||||
|
||||
context 'when format is HTML' do
|
||||
it 'renders template' do
|
||||
read_board board: board
|
||||
|
|
21
spec/helpers/boards_helper_spec.rb
Normal file
21
spec/helpers/boards_helper_spec.rb
Normal file
|
@ -0,0 +1,21 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe BoardsHelper do
|
||||
describe '#board_data' do
|
||||
let(:user) { create(:user) }
|
||||
let(:project) { create(:project) }
|
||||
let(:board) { create(:board, project: project) }
|
||||
|
||||
before do
|
||||
assign(:board, board)
|
||||
assign(:project, project)
|
||||
|
||||
allow(helper).to receive(:current_user) { user }
|
||||
allow(helper).to receive(:can?).with(user, :admin_list, project).and_return(true)
|
||||
end
|
||||
|
||||
it 'returns a board_lists_path as lists_endpoint' do
|
||||
expect(helper.board_data[:lists_endpoint]).to eq(board_lists_path(board))
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue