You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[2021-07-16 16:09:24] flarum.ERROR: TypeError: Askvortsov\FlarumWarnings\Access\UserPolicy::can(): Argument flarum/framework#3 ($user) must be of type Flarum\User\User, string given in /home/metabullet/public_html/vendor/askvortsov/flarum-moderator-warnings/src/Access/UserPolicy.php:26
Using ::class to check permissions to create something that doesn't exist yet is a standard Laravel practice which we previously implemented into core. But extensions can break it due to the can() function which itself isn't a Laravel feature.
Another option could be to not proxy ::class gates through can() in core, but that would be a breaking change.
When this extension is enabled, it's no longer possible to use model-less calls on the gate for the User model.
It's the same issue that's currently plaguing the Tags extension in Flarum https://github.com/flarum/core/issues/2908
An extension that uses such a call is my shadow ban extension with
$actor->can('shadowBan', User::class)
https://github.com/clarkwinkelmann/flarum-ext-shadow-ban/blob/main/src/Scope/ViewUser.php#L21The error is in this file
flarum-moderator-warnings/src/Access/UserPolicy.php
Line 26 in cb9e8f7
Reported on the forum here https://discuss.flarum.org/d/23228-moderator-warnings-extension/87
The text was updated successfully, but these errors were encountered: