about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--app/services/concerns/author_extractor.rb2
-rw-r--r--app/services/process_feed_service.rb2
-rw-r--r--app/services/process_interaction_service.rb6
3 files changed, 9 insertions, 1 deletions
diff --git a/app/services/concerns/author_extractor.rb b/app/services/concerns/author_extractor.rb
index d99780e7d..71bd32f37 100644
--- a/app/services/concerns/author_extractor.rb
+++ b/app/services/concerns/author_extractor.rb
@@ -2,6 +2,8 @@
 
 module AuthorExtractor
   def author_from_xml(xml)
+    return nil if xml.nil?
+
     # Try <email> for acct
     acct = xml.at_xpath('./xmlns:author/xmlns:email', xmlns: TagManager::XMLNS)&.content
 
diff --git a/app/services/process_feed_service.rb b/app/services/process_feed_service.rb
index 10e947001..87ed68f70 100644
--- a/app/services/process_feed_service.rb
+++ b/app/services/process_feed_service.rb
@@ -189,7 +189,7 @@ class ProcessFeedService < BaseService
     def find_status(uri)
       if TagManager.instance.local_id?(uri)
         local_id = TagManager.instance.unique_tag_to_local_id(uri, 'Status')
-        return Status.find(local_id)
+        return Status.find_by(id: local_id)
       end
 
       Status.find_by(uri: uri)
diff --git a/app/services/process_interaction_service.rb b/app/services/process_interaction_service.rb
index e9c01103d..bd9afaf2e 100644
--- a/app/services/process_interaction_service.rb
+++ b/app/services/process_interaction_service.rb
@@ -108,12 +108,18 @@ class ProcessInteractionService < BaseService
 
   def favourite!(xml, from_account)
     current_status = status(xml)
+
+    return if current_status.nil?
+
     favourite = current_status.favourites.where(account: from_account).first_or_create!(account: from_account)
     NotifyService.new.call(current_status.account, favourite)
   end
 
   def unfavourite!(xml, from_account)
     current_status = status(xml)
+
+    return if current_status.nil?
+
     favourite = current_status.favourites.where(account: from_account).first
     favourite&.destroy
   end