mirror of
https://github.com/kikobar/mastodon.git
synced 2024-11-16 12:12:14 +00:00
Fix duplicate @context
attribute in user export (#30653)
This commit is contained in:
parent
520b2086af
commit
19ed22dc58
|
@ -19,8 +19,8 @@ class BackupService < BaseService
|
||||||
|
|
||||||
def build_outbox_json!(file)
|
def build_outbox_json!(file)
|
||||||
skeleton = serialize(collection_presenter, ActivityPub::CollectionSerializer)
|
skeleton = serialize(collection_presenter, ActivityPub::CollectionSerializer)
|
||||||
skeleton[:@context] = full_context
|
skeleton['@context'] = full_context
|
||||||
skeleton[:orderedItems] = ['!PLACEHOLDER!']
|
skeleton['orderedItems'] = ['!PLACEHOLDER!']
|
||||||
skeleton = Oj.dump(skeleton)
|
skeleton = Oj.dump(skeleton)
|
||||||
prepend, append = skeleton.split('"!PLACEHOLDER!"')
|
prepend, append = skeleton.split('"!PLACEHOLDER!"')
|
||||||
add_comma = false
|
add_comma = false
|
||||||
|
|
|
@ -55,9 +55,11 @@ RSpec.describe BackupService, type: :service do
|
||||||
end
|
end
|
||||||
|
|
||||||
def expect_outbox_export
|
def expect_outbox_export
|
||||||
json = export_json(:outbox)
|
body = export_json_raw(:outbox)
|
||||||
|
json = Oj.load(body)
|
||||||
|
|
||||||
aggregate_failures do
|
aggregate_failures do
|
||||||
|
expect(body.scan('@context').count).to eq 1
|
||||||
expect(json['@context']).to_not be_nil
|
expect(json['@context']).to_not be_nil
|
||||||
expect(json['type']).to eq 'OrderedCollection'
|
expect(json['type']).to eq 'OrderedCollection'
|
||||||
expect(json['totalItems']).to eq 2
|
expect(json['totalItems']).to eq 2
|
||||||
|
@ -85,8 +87,12 @@ RSpec.describe BackupService, type: :service do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def export_json_raw(type)
|
||||||
|
read_zip_file(backup, "#{type}.json")
|
||||||
|
end
|
||||||
|
|
||||||
def export_json(type)
|
def export_json(type)
|
||||||
Oj.load(read_zip_file(backup, "#{type}.json"))
|
Oj.load(export_json_raw(type))
|
||||||
end
|
end
|
||||||
|
|
||||||
def include_create_item(status)
|
def include_create_item(status)
|
||||||
|
|
Loading…
Reference in a new issue