Reply with Accept activity to follows

parent 65d86128
Pipeline #163 passed with stage
in 46 seconds
......@@ -3,11 +3,12 @@ require "./converters"
class Activity
include JSON::Serializable
getter id : String?
getter object : String | Object
@[JSON::Field(key: "type", converter: FuzzyStringArrayConverter)]
getter types : Array(String)
getter object : String | Object
@[JSON::Field(key: "signature", converter: PresenceConverter)]
getter? signature_present = false
......
......@@ -50,7 +50,23 @@ class InboxHandler
error(400, "Follow only allowed for #{Activity::PUBLIC_COLLECTION}")
end
accept_activity = {
"@context": {"https://www.w3.org/ns/activitystreams", "https://w3id.org/security/v1"},
id: PubRelay.route_url("/actor#accepts/follows/#{actor.domain}"),
type: "Accept",
actor: PubRelay.route_url("/actor"),
object: {
id: activity.id,
type: "Follow",
actor: actor.id,
object: PubRelay.route_url("/actor"),
},
}
PubRelay.redis.hset("subscription:#{actor.domain}", "inbox_url", actor.inbox_url)
DeliverWorker.async.perform(actor.domain, accept_activity.to_json)
end
def handle_unfollow(actor, activity)
......
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