mirror of
https://github.com/flarum/framework.git
synced 2024-12-02 23:23:52 +08:00
Fix some incorrect automated refactorings
This commit is contained in:
parent
eb8c38af33
commit
8aab52327e
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
namespace Flarum\Api\Serializer;
|
namespace Flarum\Api\Serializer;
|
||||||
|
|
||||||
use Flarum\Core\Post;
|
use Flarum\Post\Post;
|
||||||
use Flarum\Post\CommentPost;
|
use Flarum\Post\CommentPost;
|
||||||
use InvalidArgumentException;
|
use InvalidArgumentException;
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ class BasicPostSerializer extends AbstractSerializer
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*
|
*
|
||||||
* @param \Flarum\Core\Post $post
|
* @param \Flarum\Post\Post $post
|
||||||
* @throws InvalidArgumentException
|
* @throws InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
protected function getDefaultAttributes($post)
|
protected function getDefaultAttributes($post)
|
||||||
|
|
|
@ -40,7 +40,7 @@ class DeletePostHandler
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param DeletePost $command
|
* @param DeletePost $command
|
||||||
* @return \Flarum\Core\Post
|
* @return \Flarum\Post\Post
|
||||||
* @throws \Flarum\User\Exception\PermissionDeniedException
|
* @throws \Flarum\User\Exception\PermissionDeniedException
|
||||||
*/
|
*/
|
||||||
public function handle(DeletePost $command)
|
public function handle(DeletePost $command)
|
||||||
|
|
|
@ -48,7 +48,7 @@ class EditPostHandler
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param EditPost $command
|
* @param EditPost $command
|
||||||
* @return \Flarum\Core\Post
|
* @return \Flarum\Post\Post
|
||||||
* @throws \Flarum\User\Exception\PermissionDeniedException
|
* @throws \Flarum\User\Exception\PermissionDeniedException
|
||||||
*/
|
*/
|
||||||
public function handle(EditPost $command)
|
public function handle(EditPost $command)
|
||||||
|
|
|
@ -124,8 +124,8 @@ class CoreServiceProvider extends AbstractServiceProvider
|
||||||
public function registerPostTypes()
|
public function registerPostTypes()
|
||||||
{
|
{
|
||||||
$models = [
|
$models = [
|
||||||
'Flarum\Post\Post\CommentPost',
|
'Flarum\Post\CommentPost',
|
||||||
'Flarum\Post\Post\DiscussionRenamedPost'
|
'Flarum\Post\DiscussionRenamedPost'
|
||||||
];
|
];
|
||||||
|
|
||||||
$this->app->make('events')->fire(
|
$this->app->make('events')->fire(
|
||||||
|
|
|
@ -21,7 +21,7 @@ use Flarum\Discussion\Event\Hidden;
|
||||||
use Flarum\Discussion\Event\Renamed;
|
use Flarum\Discussion\Event\Renamed;
|
||||||
use Flarum\Discussion\Event\Restored;
|
use Flarum\Discussion\Event\Restored;
|
||||||
use Flarum\Discussion\Event\Started;
|
use Flarum\Discussion\Event\Started;
|
||||||
use Flarum\Post\Event\Deleted;
|
use Flarum\Post\Event\Deleted as PostDeleted;
|
||||||
use Flarum\Event\ScopePostVisibility;
|
use Flarum\Event\ScopePostVisibility;
|
||||||
use Flarum\Post\Post;
|
use Flarum\Post\Post;
|
||||||
use Flarum\User\Guest;
|
use Flarum\User\Guest;
|
||||||
|
@ -111,7 +111,7 @@ class Discussion extends AbstractModel
|
||||||
$posts = $discussion->posts()->allTypes();
|
$posts = $discussion->posts()->allTypes();
|
||||||
|
|
||||||
foreach ($posts->get() as $post) {
|
foreach ($posts->get() as $post) {
|
||||||
$discussion->raise(new Deleted($post));
|
$discussion->raise(new PostDeleted($post));
|
||||||
}
|
}
|
||||||
|
|
||||||
$posts->delete();
|
$posts->delete();
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
namespace Flarum\Discussion\Search\Fulltext;
|
namespace Flarum\Discussion\Search\Fulltext;
|
||||||
|
|
||||||
use Flarum\Core\Post;
|
use Flarum\Post\Post;
|
||||||
|
|
||||||
class MySqlFulltextDriver implements DriverInterface
|
class MySqlFulltextDriver implements DriverInterface
|
||||||
{
|
{
|
||||||
|
|
|
@ -34,7 +34,7 @@ class PostRepository
|
||||||
*
|
*
|
||||||
* @param int $id
|
* @param int $id
|
||||||
* @param \Flarum\User\User $actor
|
* @param \Flarum\User\User $actor
|
||||||
* @return \Flarum\Core\Post
|
* @return \Flarum\Post\Post
|
||||||
*
|
*
|
||||||
* @throws \Illuminate\Database\Eloquent\ModelNotFoundException
|
* @throws \Illuminate\Database\Eloquent\ModelNotFoundException
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
namespace Flarum\User;
|
namespace Flarum\User;
|
||||||
|
|
||||||
use DomainException;
|
use DomainException;
|
||||||
use Flarum\User\Gate;
|
|
||||||
use Flarum\Group\Group;
|
use Flarum\Group\Group;
|
||||||
use Flarum\Core\Notification;
|
use Flarum\Core\Notification;
|
||||||
use Flarum\Group\Permission;
|
use Flarum\Group\Permission;
|
||||||
|
@ -21,7 +20,7 @@ use Flarum\Database\ScopeVisibilityTrait;
|
||||||
use Flarum\Database\AbstractModel;
|
use Flarum\Database\AbstractModel;
|
||||||
use Flarum\Event\CheckUserPassword;
|
use Flarum\Event\CheckUserPassword;
|
||||||
use Flarum\Event\ConfigureUserPreferences;
|
use Flarum\Event\ConfigureUserPreferences;
|
||||||
use Flarum\Post\Event\Deleted;
|
use Flarum\Post\Event\Deleted as PostDeleted;
|
||||||
use Flarum\Event\PrepareUserGroups;
|
use Flarum\Event\PrepareUserGroups;
|
||||||
use Flarum\User\Event\AvatarChanged;
|
use Flarum\User\Event\AvatarChanged;
|
||||||
use Flarum\User\Event\BioChanged;
|
use Flarum\User\Event\BioChanged;
|
||||||
|
@ -136,7 +135,7 @@ class User extends AbstractModel
|
||||||
$posts = $user->posts()->allTypes();
|
$posts = $user->posts()->allTypes();
|
||||||
|
|
||||||
foreach ($posts->get() as $post) {
|
foreach ($posts->get() as $post) {
|
||||||
$user->raise(new Deleted($post));
|
$user->raise(new PostDeleted($post));
|
||||||
}
|
}
|
||||||
|
|
||||||
$posts->delete();
|
$posts->delete();
|
||||||
|
|
|
@ -12,13 +12,13 @@
|
||||||
namespace Flarum\User;
|
namespace Flarum\User;
|
||||||
|
|
||||||
use Flarum\Discussion\Discussion;
|
use Flarum\Discussion\Discussion;
|
||||||
use Flarum\Core\Post;
|
use Flarum\Discussion\Event\Deleted as DiscussionDeleted;
|
||||||
use Flarum\Discussion\Event\Deleted;
|
|
||||||
use Flarum\Discussion\Event\Started;
|
use Flarum\Discussion\Event\Started;
|
||||||
use Flarum\Post\Event\Deleted;
|
use Flarum\Post\Event\Deleted as PostDeleted;
|
||||||
use Flarum\Post\Event\Hidden;
|
use Flarum\Post\Event\Hidden;
|
||||||
use Flarum\Post\Event\Posted;
|
use Flarum\Post\Event\Posted;
|
||||||
use Flarum\Post\Event\Restored;
|
use Flarum\Post\Event\Restored;
|
||||||
|
use Flarum\Post\Post;
|
||||||
use Illuminate\Contracts\Events\Dispatcher;
|
use Illuminate\Contracts\Events\Dispatcher;
|
||||||
|
|
||||||
class UserMetadataUpdater
|
class UserMetadataUpdater
|
||||||
|
@ -29,11 +29,11 @@ class UserMetadataUpdater
|
||||||
public function subscribe(Dispatcher $events)
|
public function subscribe(Dispatcher $events)
|
||||||
{
|
{
|
||||||
$events->listen(Posted::class, [$this, 'whenPostWasPosted']);
|
$events->listen(Posted::class, [$this, 'whenPostWasPosted']);
|
||||||
$events->listen(Deleted::class, [$this, 'whenPostWasDeleted']);
|
$events->listen(PostDeleted::class, [$this, 'whenPostWasDeleted']);
|
||||||
$events->listen(Hidden::class, [$this, 'whenPostWasHidden']);
|
$events->listen(Hidden::class, [$this, 'whenPostWasHidden']);
|
||||||
$events->listen(Restored::class, [$this, 'whenPostWasRestored']);
|
$events->listen(Restored::class, [$this, 'whenPostWasRestored']);
|
||||||
$events->listen(Started::class, [$this, 'whenDiscussionWasStarted']);
|
$events->listen(Started::class, [$this, 'whenDiscussionWasStarted']);
|
||||||
$events->listen(Deleted::class, [$this, 'whenDiscussionWasDeleted']);
|
$events->listen(DiscussionDeleted::class, [$this, 'whenDiscussionWasDeleted']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -47,7 +47,7 @@ class UserMetadataUpdater
|
||||||
/**
|
/**
|
||||||
* @param \Flarum\Post\Event\Deleted $event
|
* @param \Flarum\Post\Event\Deleted $event
|
||||||
*/
|
*/
|
||||||
public function whenPostWasDeleted(Deleted $event)
|
public function whenPostWasDeleted(PostDeleted $event)
|
||||||
{
|
{
|
||||||
$this->updateCommentsCount($event->post, -1);
|
$this->updateCommentsCount($event->post, -1);
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,7 @@ class UserMetadataUpdater
|
||||||
/**
|
/**
|
||||||
* @param \Flarum\Discussion\Event\Deleted $event
|
* @param \Flarum\Discussion\Event\Deleted $event
|
||||||
*/
|
*/
|
||||||
public function whenDiscussionWasDeleted(Deleted $event)
|
public function whenDiscussionWasDeleted(DiscussionDeleted $event)
|
||||||
{
|
{
|
||||||
$this->updateDiscussionsCount($event->discussion, -1);
|
$this->updateDiscussionsCount($event->discussion, -1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user