fix merge conflicts

This commit is contained in:
David Sevilla Martín 2018-02-12 08:34:36 -05:00
parent 62d30f140b
commit cc285f6fc8
2 changed files with 24 additions and 12 deletions

View File

@ -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);
}
];

View File

@ -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));