diffgram icon indicating copy to clipboard operation
diffgram copied to clipboard

Refactor passing user email to the events

Open vitalii-bulyzhyn opened this issue 2 years ago • 3 comments

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)

vitalii-bulyzhyn avatar Jul 11 '22 19:07 vitalii-bulyzhyn

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

anthony-chaudhary avatar Jul 11 '22 20:07 anthony-chaudhary

The idea is to get user object inside the action, so we don't repeat that everywhere

vitalii-bulyzhyn avatar Jul 11 '22 20:07 vitalii-bulyzhyn

User will come from member.user right or?

anthony-chaudhary avatar Jul 11 '22 22:07 anthony-chaudhary