mirror of
https://github.com/mastodon/mastodon.git
synced 2025-01-08 19:35:11 +01:00
Fix fediverse:creator
metadata not showing up in REST API (#33466)
This commit is contained in:
parent
08dd11f8d4
commit
dbbf450ef5
@ -170,7 +170,7 @@ class PreviewCard < ApplicationRecord
|
|||||||
private
|
private
|
||||||
|
|
||||||
def serialized_authors
|
def serialized_authors
|
||||||
if author_name? || author_url?
|
if author_name? || author_url? || author_account_id?
|
||||||
PreviewCard::Author
|
PreviewCard::Author
|
||||||
.new(self)
|
.new(self)
|
||||||
end
|
end
|
||||||
|
@ -21,7 +21,24 @@ RSpec.describe REST::PreviewCardSerializer do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when preview card has author data' do
|
context 'when preview card has fediverse author data' do
|
||||||
|
let(:preview_card) { Fabricate.build :preview_card, author_account: Fabricate(:account) }
|
||||||
|
|
||||||
|
it 'includes populated authors array' do
|
||||||
|
expect(subject.deep_symbolize_keys)
|
||||||
|
.to include(
|
||||||
|
authors: be_an(Array).and(
|
||||||
|
contain_exactly(
|
||||||
|
include(
|
||||||
|
account: be_present
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when preview card has non-fediverse author data' do
|
||||||
let(:preview_card) { Fabricate.build :preview_card, author_name: 'Name', author_url: 'https://host.example/123' }
|
let(:preview_card) { Fabricate.build :preview_card, author_name: 'Name', author_url: 'https://host.example/123' }
|
||||||
|
|
||||||
it 'includes populated authors array' do
|
it 'includes populated authors array' do
|
||||||
|
Loading…
Reference in New Issue
Block a user