add unsubscribe to email

If a user has opted out of emails then invitation mail will not be sent to the user
This commit is contained in:
Rahul 2019-07-22 02:36:42 +05:30 committed by Henne Vogelsang
parent a96722b3c3
commit 9cc74e051c
No known key found for this signature in database
GPG key ID: 9D6164C2955FADE0
3 changed files with 5 additions and 1 deletions

View file

@ -7,7 +7,7 @@ module Invitation
emails_array.each do |email|
new_user = User.find_by(email: email)
if new_user.nil?
if new_user.nil? || !new_user.opted_out?
User.invite!({ email: email }, current_user)
new_user = User.find_by(email: email)
end