Commit c6d2641f authored by Guy Thouret's avatar Guy Thouret

(feat) Ignore certain state changes when sending user notifications

1 merge request!285Reward Factors for User Activity
Pipeline #84116160 failed with stages
in 4 minutes and 39 seconds
......@@ -39,7 +39,13 @@ class UpdateUserState
private function sendStateChangeNotification(): void
{
if ($this->userState->getStateChange() !== 0) {
$ignoreStates = [
UserState::STATE_UNKNOWN,
UserState::STATE_NEW
];
if ($this->userState->getStateChange() !== 0 &&
!in_array($this->userState->getState(), $ignoreStates, false)) {
$notificationView = ($this->userState->getStateChange() > 0) ?
'rewards_state_increase' : 'rewards_state_decrease';
Dispatcher::trigger('notification', 'reward', [
......
......@@ -44,7 +44,14 @@ class UpdateUserStateEstimate
private function sendStateChangeNotification(): void
{
if ($this->estimateStateChange < 0) {
$ignoreStates = [
UserState::STATE_UNKNOWN,
UserState::STATE_RESURRECTED,
UserState::STATE_NEW
];
if ($this->estimateStateChange < 0 &&
!in_array($this->userState->getState(), $ignoreStates, false)) {
$notificationView = 'rewards_state_decrease_today';
Dispatcher::trigger('notification', 'reward', [
'to' => [
......
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