Commit 2de0bcf8 authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Remove redirecting to last visited board

Move this to EE-only. It isn't useful here since there's only one board
parent 7d5ee418
...@@ -7,7 +7,6 @@ module BoardsActions ...@@ -7,7 +7,6 @@ module BoardsActions
included do included do
include BoardsResponses include BoardsResponses
before_action :redirect_to_recent_board, only: :index
before_action :boards, only: :index before_action :boards, only: :index
before_action :board, only: :show before_action :board, only: :show
end end
...@@ -25,21 +24,6 @@ module BoardsActions ...@@ -25,21 +24,6 @@ module BoardsActions
private private
def redirect_to_recent_board
return if request.format.json?
if recently_visited = Boards::Visits::LatestService.new(board_parent, current_user).execute
board_path = case board_parent
when Project
namespace_project_board_path(id: recently_visited.board_id)
when Group
group_board_path(id: recently_visited.board_id)
end
redirect_to board_path
end
end
def boards def boards
strong_memoize(:boards) do strong_memoize(:boards) do
Boards::ListService.new(parent, current_user).execute Boards::ListService.new(parent, current_user).execute
......
...@@ -22,26 +22,6 @@ describe Groups::BoardsController do ...@@ -22,26 +22,6 @@ describe Groups::BoardsController do
expect(response.content_type).to eq 'text/html' expect(response.content_type).to eq 'text/html'
end end
it 'redirects to latest visited board' do
board = create(:board, group: group)
create(:board_group_recent_visit, group: board.group, board: board, user: user)
list_boards
expect(response).to redirect_to(group_board_path(id: board.id))
end
it 'renders template if visited board is not found' do
temporary_board = create(:board, group: group)
create(:board_group_recent_visit, group: temporary_board.group, board: temporary_board, user: user)
temporary_board.delete
list_boards
expect(response).to render_template :index
expect(response.content_type).to eq 'text/html'
end
context 'with unauthorized user' do context 'with unauthorized user' do
before do before do
allow(Ability).to receive(:allowed?).with(user, :read_cross_project, :global).and_return(true) allow(Ability).to receive(:allowed?).with(user, :read_cross_project, :global).and_return(true)
......
...@@ -28,26 +28,6 @@ describe Projects::BoardsController do ...@@ -28,26 +28,6 @@ describe Projects::BoardsController do
expect(response.content_type).to eq 'text/html' expect(response.content_type).to eq 'text/html'
end end
it 'redirects to latest visited board' do
board = create(:board, project: project)
create(:board_project_recent_visit, project: board.project, board: board, user: user)
list_boards
expect(response).to redirect_to(namespace_project_board_path(id: board.id))
end
it 'renders template if visited board is not found' do
temporary_board = create(:board, project: project)
create(:board_project_recent_visit, project: temporary_board.project, board: temporary_board, user: user)
temporary_board.delete
list_boards
expect(response).to render_template :index
expect(response.content_type).to eq 'text/html'
end
context 'with unauthorized user' do context 'with unauthorized user' do
before do before do
allow(Ability).to receive(:allowed?).with(user, :read_project, project).and_return(true) allow(Ability).to receive(:allowed?).with(user, :read_project, project).and_return(true)
......
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