Skip to content

Commit fedd0e9

Browse files
Replace 406 response with user-friendly redirect in dashboards controller for HTML requests
1 parent 9b88041 commit fedd0e9

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

app/controllers/dashboards_controller.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ def index
4141
.to_a
4242

4343
respond_to do |format|
44-
format.html { render_error status: 406 }
44+
format.html { redirect_to home_path }
4545
format.api
4646
end
4747
end
4848

4949
def show
5050
respond_to do |format|
51-
format.html { head :not_acceptable }
51+
format.html { redirect_to dashboard_link_path(@dashboard.project, @dashboard) }
5252
format.js if request.xhr?
5353
format.api
5454
end

test/functional/dashboards_controller_test.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ def setup
1313
@user_without_permission = users :users_004
1414

1515
@crud = { form: :dashboard,
16-
show_assert_response: 406,
17-
index_assert_response: 406,
16+
show_assert_response: :redirect,
17+
index_assert_response: :redirect,
1818
create_params: { name: 'tester board',
1919
enable_sidebar: true,
2020
dashboard_type: DashboardContentWelcome::TYPE_NAME,

0 commit comments

Comments
 (0)