Add Activity#object_id

Replace Activity#object_is_public_collection? with a more generic interface.
parent 36ceaeb3
......@@ -30,12 +30,12 @@ class PubRelay::Activity
PUBLIC_COLLECTION = "https://www.w3.org/ns/activitystreams#Public"
def object_is_public_collection?
def object_id
case object = @object
when String
object == PUBLIC_COLLECTION
object
when Object
object.id == PUBLIC_COLLECTION
object.id
end
end
......
......@@ -35,7 +35,7 @@ class PubRelay::WebServer::InboxHandler
end
def handle_follow(actor, activity)
unless activity.object_is_public_collection?
unless activity.object_id == Activity::PUBLIC_COLLECTION
error(400, "Follow only allowed for #{Activity::PUBLIC_COLLECTION}")
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment