Skip to content

Commit

Permalink
Fix json encode null (#120)
Browse files Browse the repository at this point in the history
* Fix json encode null

* update

* update
  • Loading branch information
datlechin authored Oct 5, 2024
1 parent 3dc8c76 commit cf5a922
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/Jobs/AutoAssignUserGroups.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,20 @@ public function __construct(User $user)

public function handle(SettingsRepositoryInterface $settings, Dispatcher $dispatcher)
{
$entries = json_decode($settings->get('fof-gamification.autoAssignedGroups'), true);
if ($this->user->isAdmin()) {
return;
}

$autoAssignGroups = $settings->get('fof-gamification.autoAssignGroups');

if (empty($autoAssignGroups)) {
return;
}

$entries = json_decode($autoAssignGroups, true);

// If there are no entries, or if the subject user is an admin, we can skip this job
if (!is_array($entries) || $this->user->isAdmin()) {
if (empty($entries)) {
return;
}

Expand Down

0 comments on commit cf5a922

Please sign in to comment.