Commit 483b5f1b authored by Sean McGivern's avatar Sean McGivern

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
parents 68360783 1b42b146
...@@ -20,7 +20,7 @@ class Projects::BoardsController < Projects::ApplicationController ...@@ -20,7 +20,7 @@ class Projects::BoardsController < Projects::ApplicationController
private private
def assign_endpoint_vars 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) @bulk_issues_path = bulk_update_project_issues_path(project)
@namespace_path = project.namespace.full_path @namespace_path = project.namespace.full_path
@labels_endpoint = project_labels_path(project) @labels_endpoint = project_labels_path(project)
......
...@@ -6,7 +6,7 @@ module BoardsHelper ...@@ -6,7 +6,7 @@ module BoardsHelper
def board_data def board_data
{ {
boards_endpoint: @boards_endpoint, boards_endpoint: @boards_endpoint,
lists_endpoint: board_lists_url(board), lists_endpoint: board_lists_path(board),
board_id: board.id, board_id: board.id,
disabled: "#{!can?(current_user, :admin_list, current_board_parent)}", disabled: "#{!can?(current_user, :admin_list, current_board_parent)}",
issue_link_base: build_issue_link_base, issue_link_base: build_issue_link_base,
......
---
title: Change boards page boards_data absolute urls to paths
merge_request: 15703
author:
type: fixed
...@@ -14,6 +14,12 @@ describe Projects::BoardsController do ...@@ -14,6 +14,12 @@ describe Projects::BoardsController do
expect { list_boards }.to change(project.boards, :count).by(1) expect { list_boards }.to change(project.boards, :count).by(1)
end 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 context 'when format is HTML' do
it 'renders template' do it 'renders template' do
list_boards list_boards
...@@ -59,6 +65,12 @@ describe Projects::BoardsController do ...@@ -59,6 +65,12 @@ describe Projects::BoardsController do
describe 'GET show' do describe 'GET show' do
let!(:board) { create(:board, project: project) } 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 context 'when format is HTML' do
it 'renders template' do it 'renders template' do
read_board board: board read_board board: board
......
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
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