Commit 304ac468 authored by Guy Thouret's avatar Guy Thouret

(fix) Only update User's state if it changes - #588

No related merge requests found
Pipeline #72497339 passed with stages
in 9 minutes and 50 seconds
......@@ -20,9 +20,12 @@ class Events
$this->eventsDispatcher->register('user_state_change', 'all', function (Core\Events\Event $event) {
$userState = Core\Analytics\UserStates\UserState::fromArray($event->getParameters());
$user = new \Minds\Entities\User($userState->getUserGuid());
$user->setUserState($userState->getState())
->setUserStateUpdatedMs($userState->getReferenceDateMs())
->save();
if ($user->getUserState() !== $userState->getState()) {
$user->setUserState($userState->getState())
->setUserStateUpdatedMs($userState->getReferenceDateMs())
->save();
}
});
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment