fix the build

This commit is contained in:
Régis Hanol 2017-09-28 15:50:01 +02:00
parent 07e84a3afa
commit 8b74c7d325
2 changed files with 1 additions and 15 deletions

View File

@ -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)

View File

@ -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