Revert "fix the build"

This reverts commit 8b74c7d325.
This commit is contained in:
Guo Xiang Tan 2017-09-29 08:35:23 +08:00
parent 8dae98a3f6
commit 6baea9948b
2 changed files with 13 additions and 5 deletions

View File

@ -167,6 +167,12 @@ class ApplicationController < ActionController::Base
render_json_error I18n.t(opts[:custom_message] || type), type: type, status: status_code
else
begin
current_user
rescue Discourse::InvalidAccess
return render plain: I18n.t(type), status: status_code
end
render html: build_not_found_page(status_code, opts[:include_ember] ? 'application' : 'no_ember')
end
end

View File

@ -1059,12 +1059,14 @@ describe TopicsController do
end
it 'returns 403 for an invalid key' do
get :show, params: {
topic_id: topic.id, slug: topic.slug, api_key: "bad"
}, format: :json
[:json, :html].each do |format|
get :show, params: {
topic_id: topic.id, slug: topic.slug, api_key: "bad"
}, format: format
expect(response.code.to_i).to be(403)
expect(response.body).to eq(I18n.t("invalid_access"))
expect(response.code.to_i).to be(403)
expect(response.body).to eq(I18n.t("invalid_access"))
end
end
end
end