about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--app/controllers/application_controller.rb6
-rw-r--r--app/services/fan_out_on_write_service.rb4
-rw-r--r--app/views/api/accounts/show.rabl2
-rw-r--r--app/views/api/statuses/show.rabl4
-rw-r--r--config/database.yml2
-rw-r--r--config/initializers/rack-mini-profiler.rb6
6 files changed, 18 insertions, 6 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index f90628b0d..b10fa977e 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -9,4 +9,10 @@ class ApplicationController < ActionController::Base
       Rack::MiniProfiler.authorize_request
     end
   end
+
+  protected
+
+  def current_account
+    current_user.try(:account)
+  end
 end
diff --git a/app/services/fan_out_on_write_service.rb b/app/services/fan_out_on_write_service.rb
index 34684a06f..dc030736b 100644
--- a/app/services/fan_out_on_write_service.rb
+++ b/app/services/fan_out_on_write_service.rb
@@ -54,6 +54,10 @@ class FanOutOnWriteService < BaseService
       def current_user
         @account.user
       end
+
+      def current_account
+        @account
+      end
     end
 
     Rabl::Renderer.new('api/statuses/show', status,  view_path: 'app/views', format: :json, scope: rabl_scope.new(receiver)).render
diff --git a/app/views/api/accounts/show.rabl b/app/views/api/accounts/show.rabl
index df70943dd..05c92c99d 100644
--- a/app/views/api/accounts/show.rabl
+++ b/app/views/api/accounts/show.rabl
@@ -7,4 +7,4 @@ node(:avatar)          { |account| asset_url(account.avatar.url(:large, false))
 node(:followers_count) { |account| account.followers.count }
 node(:following_count) { |account| account.following.count }
 node(:statuses_count)  { |account| account.statuses.count  }
-node(:following)       { |account| current_user.account.following?(account) }
+node(:following)       { |account| current_account.following?(account) }
diff --git a/app/views/api/statuses/show.rabl b/app/views/api/statuses/show.rabl
index b4a73f9a6..0f4418870 100644
--- a/app/views/api/statuses/show.rabl
+++ b/app/views/api/statuses/show.rabl
@@ -6,8 +6,8 @@ node(:content)          { |status| content_for_status(status) }
 node(:url)              { |status| url_for_target(status) }
 node(:reblogs_count)    { |status| status.reblogs_count }
 node(:favourites_count) { |status| status.favourites_count }
-node(:favourited)       { |status| current_user.account.favourited?(status) }
-node(:reblogged)        { |status| current_user.account.reblogged?(status) }
+node(:favourited)       { |status| current_account.favourited?(status) }
+node(:reblogged)        { |status| current_account.reblogged?(status) }
 
 child :reblog => :reblog do
   extends('api/statuses/show')
diff --git a/config/database.yml b/config/database.yml
index da88c65a0..e0df97ad2 100644
--- a/config/database.yml
+++ b/config/database.yml
@@ -1,6 +1,6 @@
 default: &default
   adapter: postgresql
-  pool: 15
+  pool: 17
   timeout: 5000
   encoding: unicode
 
diff --git a/config/initializers/rack-mini-profiler.rb b/config/initializers/rack-mini-profiler.rb
index 7fd50a9af..01e8aaa15 100644
--- a/config/initializers/rack-mini-profiler.rb
+++ b/config/initializers/rack-mini-profiler.rb
@@ -1,2 +1,4 @@
-Rails.application.middleware.swap(Rack::Deflater, Rack::MiniProfiler)
-Rails.application.middleware.swap(Rack::MiniProfiler, Rack::Deflater)
+unless Rails.env == 'test'
+  Rails.application.middleware.swap(Rack::Deflater, Rack::MiniProfiler)
+  Rails.application.middleware.swap(Rack::MiniProfiler, Rack::Deflater)
+end