Delete the user in a GDPR compatible way (#1151)

* Delete the user in a GDPR compatible way

* Block user from calls

* Style fix
This commit is contained in:
Nabeel S
2021-04-23 10:33:13 -04:00
committed by GitHub
parent f8c7bc31f5
commit 14d0e99a37
15 changed files with 145 additions and 18 deletions

View File

@@ -46,7 +46,7 @@ class EventHandler extends Listener
*
* @param \App\Contracts\Notification $notification
*/
protected function notifyAdmins($notification)
protected function notifyAdmins(\App\Contracts\Notification $notification)
{
$admin_users = User::whereRoleIs('admin')->get();
@@ -67,8 +67,12 @@ class EventHandler extends Listener
* @param User $user
* @param \App\Contracts\Notification $notification
*/
protected function notifyUser($user, $notification)
protected function notifyUser(User $user, \App\Contracts\Notification $notification)
{
if ($user->state === UserState::DELETED) {
return;
}
try {
$user->notify($notification);
} catch (Exception $e) {
@@ -90,7 +94,7 @@ class EventHandler extends Listener
}
/** @var Collection $users */
$users = User::where($where)->get();
$users = User::where($where)->where('state', '<>', UserState::DELETED)->get();
if (empty($users) || $users->count() === 0) {
return;
}