Skip to content

Commit

Permalink
add creator links as attachments in activitystreams
Browse files Browse the repository at this point in the history
  • Loading branch information
Floppy committed Jan 23, 2025
1 parent ddcbd70 commit 062c8d3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/models/creator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions spec/factories/creator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 4 additions & 0 deletions spec/models/creator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 062c8d3

Please sign in to comment.