Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add UserUpdatedEvent #3504

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft

Add UserUpdatedEvent #3504

wants to merge 1 commit into from

Conversation

partydragen
Copy link
Member

Added UserUpdatedEvent allows modules to eaiser detect user changes like when username change

Will need to discover possible places to execute event

$this->user = $user;

$data = DB::getInstance()->get('users', ['id', $user->data()->id]);
$this->updated_data = new UserData($data->first());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice if we could provide something like data_before, data_after and then a diff of them via data_changed

Copy link
Member Author

@partydragen partydragen May 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well this PR did not really go as planned

I want to trigger certain functions when event is triggered but as the functions require User param it will get the outdated data :/

Like to solve that i need to directly update userData on update

foreach ($fields as $key => $value) {
    $this->data()->{$key} = $value;
}

But updating the userdata directly could have bad side effects idk

Another problem i also have is integrations cache is outdated if any integrations is added/removed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants