diff --git a/app/models/creator.rb b/app/models/creator.rb index e50fd1579..323e3c622 100644 --- a/app/models/creator.rb +++ b/app/models/creator.rb @@ -50,7 +50,8 @@ def to_activitypub_object attributionDomains: [ [Rails.application.default_url_options[:host], Rails.application.default_url_options[:port]].compact.join(":") ], - concreteType: "Creator" + concreteType: "Creator", + attachment: links.map { |it| {type: "Link", href: it.url} } } end end diff --git a/spec/factories/creator.rb b/spec/factories/creator.rb index 930c1c3c7..fdfb7cd2f 100644 --- a/spec/factories/creator.rb +++ b/spec/factories/creator.rb @@ -4,5 +4,6 @@ sequence(:public_id) { |n| "creator_#{n}" } caption { Faker::Lorem.sentence } notes { Faker::Lorem.paragraph } + links_attributes { [{url: "http://example.com"}] } end end diff --git a/spec/models/creator_spec.rb b/spec/models/creator_spec.rb index 0a9fe35b7..a06288f12 100644 --- a/spec/models/creator_spec.rb +++ b/spec/models/creator_spec.rb @@ -26,5 +26,9 @@ it "includes notes in summary" do expect(ap[:summary]).to include creator.notes end + + it "includes links as attachments" do + expect(ap[:attachment]).to include({type: "Link", href: "http://example.com"}) + end end end