From c4970332eb1dbbac4ff515838d0e3e014f70f007 Mon Sep 17 00:00:00 2001 From: Benjamin Neff Date: Sat, 23 Jan 2016 02:32:41 +0100 Subject: [PATCH 1/2] set locale=en to fix locale leakage from other requests --- .../application_controller.rb | 7 +++++++ .../application_controller_spec.rb | 16 ++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 spec/controllers/diaspora_federation/application_controller_spec.rb diff --git a/app/controllers/diaspora_federation/application_controller.rb b/app/controllers/diaspora_federation/application_controller.rb index f73b00e..586b503 100644 --- a/app/controllers/diaspora_federation/application_controller.rb +++ b/app/controllers/diaspora_federation/application_controller.rb @@ -1,5 +1,12 @@ module DiasporaFederation # Base-Controller for all DiasporaFederation-Controller class ApplicationController < ActionController::Base + before_action :set_locale + + # Fix locale leakage from other requests. + # Set "en" as locale for every federation request. + def set_locale + I18n.locale = :en + end end end diff --git a/spec/controllers/diaspora_federation/application_controller_spec.rb b/spec/controllers/diaspora_federation/application_controller_spec.rb new file mode 100644 index 0000000..79084c4 --- /dev/null +++ b/spec/controllers/diaspora_federation/application_controller_spec.rb @@ -0,0 +1,16 @@ +module DiasporaFederation + describe ApplicationController, type: :controller do + controller do + def index + head :ok + end + end + + describe "#set_locale" do + it "sets the default locale" do + expect(I18n).to receive(:locale=).with(:en) + get :index + end + end + end +end From 0fb7ebc2c15bed221708cfc1e385fa1012c85d08 Mon Sep 17 00:00:00 2001 From: Benjamin Neff Date: Sat, 23 Jan 2016 02:40:28 +0100 Subject: [PATCH 2/2] release version 0.0.12 --- Gemfile.lock | 24 +++++++++++++----------- lib/diaspora_federation/version.rb | 2 +- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 4e4197f..7b9533b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,17 +1,17 @@ PATH remote: . specs: - diaspora_federation (0.0.11) + diaspora_federation (0.0.12) faraday (~> 0.9.0) faraday_middleware (~> 0.10.0) nokogiri (~> 1.6, >= 1.6.7.1) typhoeus (~> 0.7) valid (~> 1.0) - diaspora_federation-rails (0.0.11) - diaspora_federation (= 0.0.11) + diaspora_federation-rails (0.0.12) + diaspora_federation (= 0.0.12) rails (~> 4.2) - diaspora_federation-test (0.0.11) - diaspora_federation (= 0.0.11) + diaspora_federation-test (0.0.12) + diaspora_federation (= 0.0.12) factory_girl (~> 4.5, >= 4.5.0) GEM @@ -62,12 +62,13 @@ GEM codeclimate-test-reporter (0.4.8) simplecov (>= 0.7.1, < 1.0.0) coderay (1.1.0) + concurrent-ruby (1.0.0) crack (0.4.2) safe_yaml (~> 1.0.0) diff-lcs (1.2.5) docile (1.1.5) erubis (2.7.0) - ethon (0.8.0) + ethon (0.8.1) ffi (>= 1.3.0) factory_girl (4.5.0) activesupport (>= 3.0.0) @@ -247,12 +248,13 @@ GEM spring-watcher-listen (2.0.0) listen (>= 2.7, < 4.0) spring (~> 1.2) - sprockets (3.4.1) + sprockets (3.5.2) + concurrent-ruby (~> 1.0) rack (> 1, < 3) - sprockets-rails (2.3.3) - actionpack (>= 3.0) - activesupport (>= 3.0) - sprockets (>= 2.8, < 4.0) + sprockets-rails (3.0.0) + actionpack (>= 4.0) + activesupport (>= 4.0) + sprockets (>= 3.0.0) sqlite3 (1.3.11) systemu (2.6.5) terminal-table (1.5.2) diff --git a/lib/diaspora_federation/version.rb b/lib/diaspora_federation/version.rb index d135b5c..7bdb024 100644 --- a/lib/diaspora_federation/version.rb +++ b/lib/diaspora_federation/version.rb @@ -1,4 +1,4 @@ module DiasporaFederation # the gem version - VERSION = "0.0.11" + VERSION = "0.0.12" end