Merge pull request #8302 from SuperTux88/fix-local-sharing-with-me

Fix sharing status of local contacts after an import
This commit is contained in:
Benjamin Neff
2021-11-23 01:39:49 +01:00
6 changed files with 52 additions and 12 deletions

View File

@@ -13,6 +13,8 @@ class ArchiveImporter
attr_reader :user
def import
return unless json.fetch("receiving")
@imported_contact = create_contact
add_to_aspects
rescue ActiveRecord::RecordInvalid => e
@@ -34,7 +36,8 @@ class ArchiveImporter
def create_contact
person = Person.by_account_identifier(json.fetch("account_id"))
user.contacts.create!(person_id: person.id, sharing: json.fetch("sharing"), receiving: json.fetch("receiving"))
# see AccountMigration#dispatch_contacts for the other half of this when the contact is sharing with the user
user.contacts.create!(person_id: person.id, sharing: false, receiving: true)
end
end
end