Don't double check if contact can be archived when ran via Task

This commit is contained in:
Karl Erik Õunapuu 2020-09-03 16:07:09 +03:00
parent 816102130b
commit 11fc484270
No known key found for this signature in database
GPG key ID: C9DD647298A34764
3 changed files with 7 additions and 5 deletions

View file

@ -17,8 +17,10 @@ module Concerns
inactive
end
def archive
raise 'Contact cannot be archived' unless archivable?(post: true)
def archive(verified: false)
unless verified
raise 'Contact cannot be archived' unless archivable?(post: true)
end
destroy!
end

View file

@ -5,11 +5,11 @@ class InactiveContacts
@contacts = contacts
end
def archive
def archive(verified: false)
contacts.each do |contact|
log("Archiving contact: id(#{contact.id}), code(#{contact.code})")
contact.archive
contact.archive(verified: verified)
yield contact if block_given?
end
end