]> cat aescling's git repositories - mastodon.git/commitdiff
Fix #43
authorEugen Rochko <eugen@zeonfederated.com>
Sun, 18 Sep 2016 10:28:49 +0000 (12:28 +0200)
committerEugen Rochko <eugen@zeonfederated.com>
Sun, 18 Sep 2016 10:28:49 +0000 (12:28 +0200)
app/controllers/api/accounts_controller.rb
app/controllers/api/statuses_controller.rb
app/services/process_feed_service.rb
spec/services/process_feed_service_spec.rb

index 4a4431b2d5b73b5ee8e187b67e9f04dee67606b5..1a19ae43eb3561b660fce9cac5df0df174ad3460 100644 (file)
@@ -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
index 90e78a54233f625db2bd7b8f92ead4ef455ca07a..a4b183ef12bf8cfdd973fa0cd3cefddfde7ba606 100644 (file)
@@ -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
index e0b8574823dcb8b48a5c5d948608be0992ef6133..5fde19547c03f0b527d76c6641e27f843afafa42 100644 (file)
@@ -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
index 85805382381bd3e7ce3e5b3014ac0206ee575f6d..2144c02212ade9ef313ce79e2c716f3922a0ec29 100644 (file)
@@ -4,5 +4,9 @@ RSpec.describe ProcessFeedService do
   subject { ProcessFeedService.new }
 
   it 'updates remote user\'s account information'
-  it 'creates local copies of all notes and comments'
+  it 'creates posts'
+  it 'creates reblogs'
+  it 'creates replies'
+  it 'creates reblogged replies'
+  it 'deletes removed posts'
 end