FriendsOfFlarum / gamification

Add upvotes, downvotes, and ranks to your Flarum Community
https://discuss.flarum.org/d/20671-friendsofflarum-gamification
MIT License
36 stars 17 forks source link

Fix json encode null #120

Open datlechin opened 2 months ago

datlechin commented 2 months ago

Fix json encode null in php8.3

Fixes #0000

Changes proposed in this pull request:

Reviewers should focus on:

Screenshot

Confirmed

Required changes:

luceos commented 1 month ago

@DavideIadeluca if you want to do an optimization, although just a slight one, stop early instead of accessing the settings repository first (which you then don't need for an admin):

        if ($this->user->isAdmin()) return;

        return json_decode(
                $settings->get('fof-gamification.autoAssignGroups', '[]'),
                true
        );
DavideIadeluca commented 1 month ago

@DavideIadeluca if you want to do an optimization, although just a slight one, stop early instead of accessing the settings repository first (which you then don't need for an admin):

        if ($this->user->isAdmin()) return;

        return json_decode(
                $settings->get('fof-gamification.autoAssignGroups', '[]'),
                true
        );

Yeah right, makes sense. @datlechin Can you please use the suggestion of @luceos instead? 🙏