main
main copied to clipboard
Bug duplicate emails from different sources
Now that we're adding our own users directly and importing from facebook we have situations where a person has an email which is the same as is being imported.
def request_single_resource_from_action_network(uri, group) retries ||= 0
resource = resource_class.new
client = representer_class.new(resource)
client.get(uri: uri, as: 'application/json') do |request|
request['OSDI-API-TOKEN'] = group.an_api_key
end
# we need something which also checks about a user with the same email.
if Person.any_identifier(resource.identifier('action_network')).exists?
update_single_resource(resource)
else
resource.groups.push(group)
create_single_resource(resource)
end
rescue => e logger.error e.inspect retry if (retries += 1) < 3 nil end
Right now we only update resources if they're a person and if that person has the right foreign UUID. We need to check and handle this for email addresses too and the associated object not just person.
we've put the Facebook tool on the back burner and it doesn't currently work in production, so I'm deferring testing this.