From adffc7a49527d816f95e34268ebf196d9f020579 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Sun, 18 Sep 2016 12:28:49 +0200 Subject: Fix #43 --- app/controllers/api/accounts_controller.rb | 2 +- app/controllers/api/statuses_controller.rb | 8 ++++---- app/services/process_feed_service.rb | 3 ++- 3 files changed, 7 insertions(+), 6 deletions(-) (limited to 'app') diff --git a/app/controllers/api/accounts_controller.rb b/app/controllers/api/accounts_controller.rb index 4a4431b2d..1a19ae43e 100644 --- a/app/controllers/api/accounts_controller.rb +++ b/app/controllers/api/accounts_controller.rb @@ -15,7 +15,7 @@ class Api::AccountsController < ApiController end def statuses - @statuses = @account.statuses.with_includes.with_counters.paginate_by_max_id(20, params[:max_id] || nil) + @statuses = @account.statuses.with_includes.with_counters.paginate_by_max_id(20, params[:max_id] || nil).to_a end def follow diff --git a/app/controllers/api/statuses_controller.rb b/app/controllers/api/statuses_controller.rb index 90e78a542..a4b183ef1 100644 --- a/app/controllers/api/statuses_controller.rb +++ b/app/controllers/api/statuses_controller.rb @@ -8,8 +8,8 @@ class Api::StatusesController < ApiController def context @status = Status.find(params[:id]) - @ancestors = @status.ancestors.with_includes.with_counters - @descendants = @status.descendants.with_includes.with_counters + @ancestors = @status.ancestors.with_includes.with_counters.to_a + @descendants = @status.descendants.with_includes.with_counters.to_a end def create @@ -28,10 +28,10 @@ class Api::StatusesController < ApiController end def home - @statuses = Feed.new(:home, current_user.account).get(20, params[:max_id]) + @statuses = Feed.new(:home, current_user.account).get(20, params[:max_id]).to_a end def mentions - @statuses = Feed.new(:mentions, current_user.account).get(20, params[:max_id]) + @statuses = Feed.new(:mentions, current_user.account).get(20, params[:max_id]).to_a end end diff --git a/app/services/process_feed_service.rb b/app/services/process_feed_service.rb index e0b857482..5fde19547 100644 --- a/app/services/process_feed_service.rb +++ b/app/services/process_feed_service.rb @@ -129,7 +129,8 @@ class ProcessFeedService < BaseService account = follow_remote_account_service.("#{username}@#{domain}", false) end - Status.new(account: account, uri: target_id(xml), text: target_content(xml), url: target_url(xml)) + status = Status.new(account: account, uri: target_id(xml), text: target_content(xml), url: target_url(xml), created_at: published(xml), updated_at: updated(xml)) + status.thread = find_original_status(xml, thread_id(xml)) rescue Goldfinger::Error, HTTP::Error nil end -- cgit