]> cat aescling's git repositories - mastodon.git/commitdiff
Raise an error on getting activity uri for remote status (#4984)
authorunarist <m.unarist@gmail.com>
Sun, 17 Sep 2017 11:51:34 +0000 (20:51 +0900)
committerEugen Rochko <eugen@zeonfederated.com>
Sun, 17 Sep 2017 11:51:34 +0000 (13:51 +0200)
We had returned `nil` for that case, but this raises an error instead, as a wrong usage of the method.
This method is currently only used in ActivitySerializer.

app/lib/activitypub/tag_manager.rb

index 929e87852cd632b77074aabfc9235b2164e9d3ca..1b4e271db5617b422d0adf6511d7438d2b40ea5e 100644 (file)
@@ -37,7 +37,7 @@ class ActivityPub::TagManager
   end
 
   def activity_uri_for(target)
-    return nil unless %i(note comment activity).include?(target.object_type) && target.local?
+    raise ArgumentError, 'target must be a local activity' unless %i(note comment activity).include?(target.object_type) && target.local?
 
     activity_account_status_url(target.account, target)
   end