affinityworks / main

Tools for building collaborative advocacy and social change.
https://affinity.works
GNU Affero General Public License v3.0
53 stars 13 forks source link

remove email format validation on API sync #413

Open Matt-Holland opened 6 years ago

Matt-Holland commented 6 years ago

The ActionNetwork database contains strings in the email field which are not valid email addresses. When we try to validate them during the sync process we get errors like

`Error message ActiveRecord::RecordInvalid: Validation failed: Email addresses address 'ofelia.cortes@seiu-usww.seiu-usaa' does not match (?i-mx:\A([^@\s]+)@((?:[-a-z0-9]+.)+[a-z]{2,})\z)

Stack trace (show Rails) /app/app/models/api/action_network/import.rb: 92:in tap' /app/app/models/api/action_network/import.rb: 92:increate_single_resource' /app/app/models/api/action_network/person.rb: 46:in after_import' /app/app/models/api/action_network/ person.rb: 8:inblock in import!' /app/app/models/api/action_network/ import.rb: 44:in request_single_resource_from_action_network' /app/app/models/api/action_network/ person.rb: 7:inimport!' /app/app/models/api/action_network/taggings.rb: 44:in find_or_import_person' /app/app/models/api/action_network/taggings.rb: 27:inassociate_person' /app/app/models/api/action_network/taggings.rb: 16:in block in import!' /app/app/models/api/action_network/taggings.rb: 16:ineach' /app/app/models/api/action_network/taggings.rb: 16:in import!' /app/app/models/api/action_network/tags.rb: 23:inblock in import!' /app/app/models/api/action_network/tags.rb: 19:in each' /app/app/models/api/action_network/tags.rb: 19:inimport!' /app/app/models/group.rb: 48:in import_tags' /app/app/models/group.rb: 64:insync_with_action_network' …or/bundle/ruby/2.3.0/gems/rake-12.0.0/lib/rake/task.rb: 250:in block in execute' …or/bundle/ruby/2.3.0/gems/rake-12.0.0/lib/rake/task.rb: 250:ineach' …or/bundle/ruby/2.3.0/gems/rake-12.0.0/lib/rake/task.rb: 250:in execute' …or/bundle/ruby/2.3.0/gems/rake-12.0.0/lib/rake/task.rb: 194:inblock in invoke_with_call_chain' /app/vendor/ruby-2.3.3/lib/ruby/2.3.0/monitor.rb: 214:in mon_synchronize' …or/bundle/ruby/2.3.0/gems/rake-12.0.0/lib/rake/task.rb: 187:ininvoke_with_call_chain' …or/bundle/ruby/2.3.0/gems/rake-12.0.0/lib/rake/task.rb: 180:in invoke' …le/ruby/2.3.0/gems/rake-12.0.0/lib/rake/application.rb: 152:ininvoke_task' …le/ruby/2.3.0/gems/rake-12.0.0/lib/rake/application.rb: 108:in block (2 levels) in top_level' …le/ruby/2.3.0/gems/rake-12.0.0/lib/rake/application.rb: 108:ineach' …le/ruby/2.3.0/gems/rake-12.0.0/lib/rake/application.rb: 108:in block in top_level' …le/ruby/2.3.0/gems/rake-12.0.0/lib/rake/application.rb: 117:inrun_with_threads' …le/ruby/2.3.0/gems/rake-12.0.0/lib/rake/application.rb: 102:in top_level' …le/ruby/2.3.0/gems/rake-12.0.0/lib/rake/application.rb: 80:inblock in run' …le/ruby/2.3.0/gems/rake-12.0.0/lib/rake/application.rb: 178:in standard_exception_handling' …le/ruby/2.3.0/gems/rake-12.0.0/lib/rake/application.rb: 77:inrun' …ruby/2.3.0/gems/bundler-1.15.2/lib/bundler/cli/exec.rb: 74:in load' …ruby/2.3.0/gems/bundler-1.15.2/lib/bundler/cli/exec.rb: 74:inkernel_load' …ruby/2.3.0/gems/bundler-1.15.2/lib/bundler/cli/exec.rb: 27:in run' …ndle/ruby/2.3.0/gems/bundler-1.15.2/lib/bundler/cli.rb: 360:inexec' …ler-1.15.2/lib/bundler/vendor/thor/lib/thor/command.rb: 27:in run' …-1.15.2/lib/bundler/vendor/thor/lib/thor/invocation.rb: 126:ininvoke_command' …ems/bundler-1.15.2/lib/bundler/vendor/thor/lib/thor.rb: 369:in dispatch' …ndle/ruby/2.3.0/gems/bundler-1.15.2/lib/bundler/cli.rb: 20:indispatch' …undler-1.15.2/lib/bundler/vendor/thor/lib/thor/base.rb: 444:in start' …ndle/ruby/2.3.0/gems/bundler-1.15.2/lib/bundler/cli.rb: 10:instart' …3.0/gems/bundler-1.15.2/lib/bundler/ friendly_errors.rb: 121:in with_friendly_errors'

We don't want to break when we sync faulty data from someone else via the API. We need to remove this validation.

arnolfontalvo commented 6 years ago

@Matt-Holland @rabble I started to work on this issue, let me know if you are agree or if there is a better ticket for me.