Account import: add missing profile fields

This commit is contained in:
cmrd Senya 2019-04-27 17:44:19 +03:00
parent b5db8820d6
commit ee0c3e9865
2 changed files with 7 additions and 1 deletions

View file

@ -42,7 +42,7 @@ class ArchiveImporter
attr_reader :archive_hash
def profile_attributes
allowed_keys = %w[first_name last_name image_url bio searchable nsfw tag_string]
allowed_keys = %w[first_name last_name image_url bio gender location birthday searchable nsfw tag_string]
profile_data = archive_hash["user"]["profile"]["entity_data"]
convert_keys(profile_data, allowed_keys).tap do |attrs|
attrs[:public_details] = profile_data["public"]

View file

@ -125,6 +125,9 @@ describe ArchiveImporter do
"full_name" => "Full Name",
"image_url" => "https://example.com/my_avatar.png",
"bio" => "I'm just a test account",
"gender" => "Robot",
"birthday" => "2006-01-01",
"location" => "diaspora* specs",
"searchable" => false,
"public" => true,
"nsfw" => true,
@ -157,6 +160,9 @@ describe ArchiveImporter do
expect(archive_importer.user.profile.last_name).to eq("Last")
expect(archive_importer.user.profile.image_url).to eq("https://example.com/my_avatar.png")
expect(archive_importer.user.profile.bio).to eq("I'm just a test account")
expect(archive_importer.user.profile.gender).to eq("Robot")
expect(archive_importer.user.profile.birthday).to eq(Date.new(2006, 1, 1))
expect(archive_importer.user.profile.location).to eq("diaspora* specs")
expect(archive_importer.user.profile.searchable).to eq(false)
expect(archive_importer.user.profile.public_details).to eq(true)
expect(archive_importer.user.profile.nsfw).to eq(true)