mirror of
https://github.com/flarum/core.git
synced 2025-10-12 23:44:27 +02:00
Extract new Flarum\Post namespace
This commit is contained in:
@@ -13,9 +13,9 @@ namespace Flarum\Core\Command;
|
||||
|
||||
use Flarum\Core\Access\AssertPermissionTrait;
|
||||
use Flarum\User\Exception\PermissionDeniedException;
|
||||
use Flarum\Core\Repository\PostRepository;
|
||||
use Flarum\Post\PostRepository;
|
||||
use Flarum\Foundation\DispatchEventsTrait;
|
||||
use Flarum\Event\PostWillBeDeleted;
|
||||
use Flarum\Post\Event\Deleting;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
|
||||
class DeletePostHandler
|
||||
@@ -24,13 +24,13 @@ class DeletePostHandler
|
||||
use AssertPermissionTrait;
|
||||
|
||||
/**
|
||||
* @var PostRepository
|
||||
* @var \Flarum\Post\PostRepository
|
||||
*/
|
||||
protected $posts;
|
||||
|
||||
/**
|
||||
* @param Dispatcher $events
|
||||
* @param PostRepository $posts
|
||||
* @param \Flarum\Post\PostRepository $posts
|
||||
*/
|
||||
public function __construct(Dispatcher $events, PostRepository $posts)
|
||||
{
|
||||
@@ -52,7 +52,7 @@ class DeletePostHandler
|
||||
$this->assertCan($actor, 'delete', $post);
|
||||
|
||||
$this->events->fire(
|
||||
new PostWillBeDeleted($post, $actor, $command->data)
|
||||
new Deleting($post, $actor, $command->data)
|
||||
);
|
||||
|
||||
$post->delete();
|
||||
|
@@ -12,11 +12,11 @@
|
||||
namespace Flarum\Core\Command;
|
||||
|
||||
use Flarum\Core\Access\AssertPermissionTrait;
|
||||
use Flarum\Core\Post\CommentPost;
|
||||
use Flarum\Core\Repository\PostRepository;
|
||||
use Flarum\Post\CommentPost;
|
||||
use Flarum\Post\PostRepository;
|
||||
use Flarum\Foundation\DispatchEventsTrait;
|
||||
use Flarum\Core\Validator\PostValidator;
|
||||
use Flarum\Event\PostWillBeSaved;
|
||||
use Flarum\Post\PostValidator;
|
||||
use Flarum\Post\Event\Saving;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
|
||||
class EditPostHandler
|
||||
@@ -25,19 +25,19 @@ class EditPostHandler
|
||||
use AssertPermissionTrait;
|
||||
|
||||
/**
|
||||
* @var PostRepository
|
||||
* @var \Flarum\Post\PostRepository
|
||||
*/
|
||||
protected $posts;
|
||||
|
||||
/**
|
||||
* @var PostValidator
|
||||
* @var \Flarum\Post\PostValidator
|
||||
*/
|
||||
protected $validator;
|
||||
|
||||
/**
|
||||
* @param Dispatcher $events
|
||||
* @param PostRepository $posts
|
||||
* @param PostValidator $validator
|
||||
* @param \Flarum\Post\PostValidator $validator
|
||||
*/
|
||||
public function __construct(Dispatcher $events, PostRepository $posts, PostValidator $validator)
|
||||
{
|
||||
@@ -79,7 +79,7 @@ class EditPostHandler
|
||||
}
|
||||
|
||||
$this->events->fire(
|
||||
new PostWillBeSaved($post, $actor, $data)
|
||||
new Saving($post, $actor, $data)
|
||||
);
|
||||
|
||||
$this->validator->assertValid($post->getDirty());
|
||||
|
@@ -14,11 +14,11 @@ namespace Flarum\Core\Command;
|
||||
use DateTime;
|
||||
use Flarum\Core\Access\AssertPermissionTrait;
|
||||
use Flarum\Core\Notification\NotificationSyncer;
|
||||
use Flarum\Core\Post\CommentPost;
|
||||
use Flarum\Post\CommentPost;
|
||||
use Flarum\Core\Repository\DiscussionRepository;
|
||||
use Flarum\Foundation\DispatchEventsTrait;
|
||||
use Flarum\Core\Validator\PostValidator;
|
||||
use Flarum\Event\PostWillBeSaved;
|
||||
use Flarum\Post\PostValidator;
|
||||
use Flarum\Post\Event\Saving;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
|
||||
class PostReplyHandler
|
||||
@@ -37,7 +37,7 @@ class PostReplyHandler
|
||||
protected $notifications;
|
||||
|
||||
/**
|
||||
* @var PostValidator
|
||||
* @var \Flarum\Post\PostValidator
|
||||
*/
|
||||
protected $validator;
|
||||
|
||||
@@ -96,7 +96,7 @@ class PostReplyHandler
|
||||
}
|
||||
|
||||
$this->events->fire(
|
||||
new PostWillBeSaved($post, $actor, $command->data)
|
||||
new Saving($post, $actor, $command->data)
|
||||
);
|
||||
|
||||
$this->validator->assertValid($post->getAttributes());
|
||||
|
Reference in New Issue
Block a user