mirror of
https://github.com/flarum/framework.git
synced 2025-01-19 18:12:59 +08:00
fix merge conflicts
This commit is contained in:
parent
62d30f140b
commit
cc285f6fc8
|
@ -9,16 +9,26 @@
|
|||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Flarum\Extend;
|
||||
use Flarum\Suspend\Access;
|
||||
use Flarum\Suspend\Listener;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
|
||||
return function (Dispatcher $events) {
|
||||
$events->subscribe(Listener\AddClientAssets::class);
|
||||
$events->subscribe(Listener\AddUserSuspendAttributes::class);
|
||||
$events->subscribe(Listener\RevokeAccessFromSuspendedUsers::class);
|
||||
$events->subscribe(Listener\SaveSuspensionToDatabase::class);
|
||||
$events->subscribe(Listener\SendNotificationWhenUserIsSuspended::class);
|
||||
return [
|
||||
(new Extend\Assets('forum'))
|
||||
->asset(__DIR__.'/js/forum/dist/extension.js')
|
||||
->asset(__DIR__.'/less/forum/extension.less')
|
||||
->bootstrapper('flarum/suspend/main'),
|
||||
(new Extend\Assets('admin'))
|
||||
->asset(__DIR__.'/js/admin/dist/extension.js')
|
||||
->asset(__DIR__.'/less/admin/extension.less')
|
||||
->bootstrapper('flarum/suspend/main'),
|
||||
function (Dispatcher $events) {
|
||||
$events->subscribe(Listener\AddUserSuspendAttributes::class);
|
||||
$events->subscribe(Listener\RevokeAccessFromSuspendedUsers::class);
|
||||
$events->subscribe(Listener\SaveSuspensionToDatabase::class);
|
||||
$events->subscribe(Listener\SendNotificationWhenUserIsSuspended::class);
|
||||
|
||||
$events->subscribe(Access\UserPolicy::class);
|
||||
};
|
||||
$events->subscribe(Access\UserPolicy::class);
|
||||
}
|
||||
];
|
||||
|
|
|
@ -12,11 +12,11 @@
|
|||
namespace Flarum\Suspend\Listener;
|
||||
|
||||
use DateTime;
|
||||
use Flarum\Core\Access\AssertPermissionTrait;
|
||||
use Flarum\Event\UserWillBeSaved;
|
||||
use Flarum\Suspend\SuspendValidator;
|
||||
use Flarum\Suspend\Event\UserWasSuspended;
|
||||
use Flarum\Suspend\Event\UserWasUnsuspended;
|
||||
use Flarum\Suspend\SuspendValidator;
|
||||
use Flarum\User\AssertPermissionTrait;
|
||||
use Flarum\User\Event\Saving;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
|
||||
class SaveSuspensionToDatabase
|
||||
|
@ -61,7 +61,9 @@ class SaveSuspensionToDatabase
|
|||
|
||||
$this->assertCan($actor, 'suspend', $user);
|
||||
|
||||
$user->suspend_until = new DateTime($attributes['suspendUntil']);
|
||||
$user->suspend_until = $attributes['suspendUntil']
|
||||
? new DateTime($attributes['suspendUntil'])
|
||||
: null;
|
||||
|
||||
if (isset($attributes['suspendUntil'])) {
|
||||
$user->raise(new UserWasSuspended($user, $actor));
|
||||
|
|
Loading…
Reference in New Issue
Block a user