fix(targeted_user_link): on invitation user are not always already created
This commit is contained in:
parent
9f6a8cfe33
commit
8eceee54ff
1 changed files with 3 additions and 2 deletions
|
@ -17,7 +17,7 @@ class TargetedUserLink < ApplicationRecord
|
|||
enum target_context: { avis: 'avis', invite: 'invite' }
|
||||
|
||||
def invalid_signed_in_user?(signed_in_user)
|
||||
signed_in_user && signed_in_user != self.user
|
||||
signed_in_user && signed_in_user.email != target_email
|
||||
end
|
||||
|
||||
def target_email
|
||||
|
@ -35,7 +35,8 @@ class TargetedUserLink < ApplicationRecord
|
|||
case target_context
|
||||
when "invite"
|
||||
invite = target_model
|
||||
invite.user&.active? ?
|
||||
user = User.find_by(email: target_email)
|
||||
user&.active? ?
|
||||
url_helper.invite_path(invite) :
|
||||
url_helper.invite_path(invite, params: { email: invite.email })
|
||||
when "avis"
|
||||
|
|
Loading…
Reference in a new issue