diffgram
diffgram copied to clipboard
Refactor passing user email to the events
Now we are passing user email to the events as following:
Event.new(
session = session,
kind = "new_attribute_template_group",
member = user.member if user else None,
success = True,
project_id = project.id,
email = user.email
)
Now, if we want to trigger this (or I assume any other) endpoint directly with generated credentials, this will though the error becase "user" won't exist
The idea is to move getting user inside the new method of Event class, so we don't pass it as a parameter all the time (as @PJEstrada mentioned that may not work for all the events, so we need to check them all)
Yes member
is the right thing to pass here
Historical view: email
was only needed for segment thing... at this exact moment it's not super important so we could also just delete that for now (as a interim step to adding getting it internally) for faster refactor
The idea is to get user object inside the action, so we don't repeat that everywhere
User will come from member.user
right or?