about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-11-08 19:37:08 +0100
committerEugen Rochko <eugen@zeonfederated.com>2016-11-08 19:37:08 +0100
commitb6832553ff023164cce2dd01889155aa9be216bf (patch)
treeb3581ef2d5348f2c64c03896e737061abcd7946a /app
parentcff0b03cbb032e271a896ce6932af9353ea32507 (diff)
Adding more logging
Diffstat (limited to 'app')
-rw-r--r--app/services/process_feed_service.rb16
1 files changed, 14 insertions, 2 deletions
diff --git a/app/services/process_feed_service.rb b/app/services/process_feed_service.rb
index 1fac60fe5..a566c3a57 100644
--- a/app/services/process_feed_service.rb
+++ b/app/services/process_feed_service.rb
@@ -44,6 +44,11 @@ class ProcessFeedService < BaseService
       if verb == :share
         original_status = status_from_xml(@xml.at_xpath('.//activity:object', activity: ACTIVITY_NS))
         status.reblog   = original_status
+
+        if original_status.nil?
+          status.destroy
+          return nil
+        end
       end
 
       status.save!
@@ -68,15 +73,22 @@ class ProcessFeedService < BaseService
       status = find_status(id(entry))
       return status unless status.nil?
 
+      begin
+        account = account?(entry) ? find_or_resolve_account(acct(entry)) : @account
+      rescue Goldfinger::Error
+        return nil
+      end
+
       status = Status.create!({
         uri: id(entry),
         url: url(entry),
-        account: account?(entry) ? find_or_resolve_account(acct(entry)) : @account,
+        account: account,
         text: content(entry),
         created_at: published(entry),
       })
 
       if thread?(entry)
+        Rails.logger.debug "Trying to attach #{status.id} (#{id(entry)}) to #{thread(entry).first}"
         status.thread = find_or_resolve_status(status, *thread(entry))
       end
 
@@ -136,7 +148,7 @@ class ProcessFeedService < BaseService
     end
 
     def hashtags_from_xml(parent, xml)
-      tags = xml.xpath('./xmlns:category').map { |category| category['term'] }
+      tags = xml.xpath('./xmlns:category').map { |category| category['term'] }.select { |t| !t.blank? }
       ProcessHashtagsService.new.call(parent, tags)
     end