From 8b74c7d325ace3ad5deaebdec50d015ca09299fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Hanol?= Date: Thu, 28 Sep 2017 15:50:01 +0200 Subject: [PATCH] fix the build --- app/controllers/application_controller.rb | 9 +-------- spec/controllers/topics_controller_spec.rb | 7 ------- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 7a7f9cf7263..5f5537ae3b8 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -159,14 +159,7 @@ class ApplicationController < ActionController::Base (request.xhr?) || ((params[:external_id] || '').ends_with? '.json') - invalid_user = - begin - current_user - rescue Discourse::InvalidAccess - nil - end - - if show_json_errors || invalid_user + if show_json_errors # HACK: do not use render_json_error for topics#show if request.params[:controller] == 'topics' && request.params[:action] == 'show' return render status: status_code, layout: false, plain: (status_code == 404 || status_code == 410) ? build_not_found_page(status_code) : I18n.t(type) diff --git a/spec/controllers/topics_controller_spec.rb b/spec/controllers/topics_controller_spec.rb index 868603f845b..15e6d6f6060 100644 --- a/spec/controllers/topics_controller_spec.rb +++ b/spec/controllers/topics_controller_spec.rb @@ -1065,13 +1065,6 @@ describe TopicsController do expect(response.code.to_i).to be(403) expect(response.body).to eq(I18n.t("invalid_access")) - - get :show, params: { - topic_id: topic.id, slug: topic.slug, api_key: "bad" - }, format: :html - - expect(response.code.to_i).to be(403) - expect(response.body).to eq(I18n.t("invalid_access")) end end end