1
0
mirror of https://github.com/flarum/core.git synced 2025-07-19 07:41:22 +02:00

Merge branch 'master' into visibility-scoping

# Conflicts:
#	bootstrap.php
This commit is contained in:
Toby Zerner
2018-01-21 08:36:02 +10:30
3 changed files with 19 additions and 57 deletions

View File

@@ -1,6 +1,6 @@
The MIT License (MIT) The MIT License (MIT)
Copyright (c) 2014-2017 Toby Zerner Copyright (c) 2014-2018 Toby Zerner
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@@ -11,15 +11,24 @@
use Flarum\Approval\Access; use Flarum\Approval\Access;
use Flarum\Approval\Listener; use Flarum\Approval\Listener;
use Flarum\Extend;
use Illuminate\Contracts\Events\Dispatcher; use Illuminate\Contracts\Events\Dispatcher;
return function (Dispatcher $events) { return [
$events->subscribe(Listener\AddClientAssets::class); (new Extend\Assets('forum'))
$events->subscribe(Listener\AddPostApprovalAttributes::class); ->defaultAssets(__DIR__)
$events->subscribe(Listener\ApproveContent::class); ->bootstrapper('flarum/approval/main'),
$events->subscribe(Listener\UnapproveNewContent::class); (new Extend\Assets('admin'))
->asset(__DIR__.'/js/admin/dist/extension.js')
->bootstrapper('flarum/approval/main'),
function (Dispatcher $events) {
$events->subscribe(Listener\AddPostApprovalAttributes::class);
$events->subscribe(Listener\ApproveContent::class);
$events->subscribe(Listener\HideUnapprovedContent::class);
$events->subscribe(Listener\UnapproveNewContent::class);
$events->subscribe(Access\TagPolicy::class); $events->subscribe(Access\TagPolicy::class);
$events->subscribe(Access\DiscussionPolicy::class); $events->subscribe(Access\DiscussionPolicy::class);
$events->subscribe(Access\PostPolicy::class); $events->subscribe(Access\PostPolicy::class);
}; },
];

View File

@@ -1,47 +0,0 @@
<?php
/*
* This file is part of Flarum.
*
* (c) Toby Zerner <toby.zerner@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Flarum\Approval\Listener;
use Flarum\Frontend\Event\Rendering;
use Illuminate\Contracts\Events\Dispatcher;
class AddClientAssets
{
/**
* @param Dispatcher $events
*/
public function subscribe(Dispatcher $events)
{
$events->listen(Rendering::class, [$this, 'addAssets']);
}
/**
* @param Rendering $event
*/
public function addAssets(Rendering $event)
{
if ($event->isForum()) {
$event->addAssets([
__DIR__.'/../../js/forum/dist/extension.js',
__DIR__.'/../../less/forum/extension.less'
]);
$event->addBootstrapper('flarum/approval/main');
}
if ($event->isAdmin()) {
$event->addAssets([
__DIR__.'/../../js/admin/dist/extension.js'
]);
$event->addBootstrapper('flarum/approval/main');
}
}
}