diff --git a/src/Api/Controller/ListDiscussionsController.php b/src/Api/Controller/ListDiscussionsController.php index c39d2d6a4..a1acdb651 100644 --- a/src/Api/Controller/ListDiscussionsController.php +++ b/src/Api/Controller/ListDiscussionsController.php @@ -12,7 +12,7 @@ namespace Flarum\Api\Controller; use Flarum\Api\UrlGenerator; -use Flarum\Core\Search\Discussion\DiscussionSearcher; +use Flarum\Discussion\Search\DiscussionSearcher; use Flarum\Core\Search\SearchCriteria; use Psr\Http\Message\ServerRequestInterface; use Tobscure\JsonApi\Document; diff --git a/src/Api/Controller/ListNotificationsController.php b/src/Api/Controller/ListNotificationsController.php index c1681d645..c167498fe 100644 --- a/src/Api/Controller/ListNotificationsController.php +++ b/src/Api/Controller/ListNotificationsController.php @@ -11,7 +11,7 @@ namespace Flarum\Api\Controller; -use Flarum\Core\Discussion; +use Flarum\Discussion\Discussion; use Flarum\User\Exception\PermissionDeniedException; use Flarum\Core\Repository\NotificationRepository; use Psr\Http\Message\ServerRequestInterface; diff --git a/src/Api/Controller/ShowDiscussionController.php b/src/Api/Controller/ShowDiscussionController.php index 171ddc8e4..4ee73d225 100644 --- a/src/Api/Controller/ShowDiscussionController.php +++ b/src/Api/Controller/ShowDiscussionController.php @@ -11,8 +11,8 @@ namespace Flarum\Api\Controller; -use Flarum\Core\Discussion; -use Flarum\Core\Repository\DiscussionRepository; +use Flarum\Discussion\Discussion; +use Flarum\Discussion\DiscussionRepository; use Flarum\Post\PostRepository; use Flarum\User\User; use Psr\Http\Message\ServerRequestInterface; @@ -21,7 +21,7 @@ use Tobscure\JsonApi\Document; class ShowDiscussionController extends AbstractShowController { /** - * @var DiscussionRepository + * @var \Flarum\Discussion\DiscussionRepository */ protected $discussions; @@ -58,7 +58,7 @@ class ShowDiscussionController extends AbstractShowController ]; /** - * @param \Flarum\Core\Repository\DiscussionRepository $discussions + * @param \Flarum\Discussion\DiscussionRepository $discussions * @param \Flarum\Post\PostRepository $posts */ public function __construct(DiscussionRepository $discussions, PostRepository $posts) diff --git a/src/Api/Serializer/BasicDiscussionSerializer.php b/src/Api/Serializer/BasicDiscussionSerializer.php index 1fb175601..a82c9c7b7 100644 --- a/src/Api/Serializer/BasicDiscussionSerializer.php +++ b/src/Api/Serializer/BasicDiscussionSerializer.php @@ -11,7 +11,7 @@ namespace Flarum\Api\Serializer; -use Flarum\Core\Discussion; +use Flarum\Discussion\Discussion; use InvalidArgumentException; class BasicDiscussionSerializer extends AbstractSerializer diff --git a/src/Api/Serializer/DiscussionSerializer.php b/src/Api/Serializer/DiscussionSerializer.php index 96704df22..17c43e970 100644 --- a/src/Api/Serializer/DiscussionSerializer.php +++ b/src/Api/Serializer/DiscussionSerializer.php @@ -12,7 +12,7 @@ namespace Flarum\Api\Serializer; use Flarum\User\Gate; -use Flarum\Core\Discussion; +use Flarum\Discussion\Discussion; class DiscussionSerializer extends BasicDiscussionSerializer { diff --git a/src/Core/Command/DeleteDiscussionHandler.php b/src/Core/Command/DeleteDiscussionHandler.php index 459432041..4665db213 100644 --- a/src/Core/Command/DeleteDiscussionHandler.php +++ b/src/Core/Command/DeleteDiscussionHandler.php @@ -13,9 +13,9 @@ namespace Flarum\Core\Command; use Flarum\Core\Access\AssertPermissionTrait; use Flarum\User\Exception\PermissionDeniedException; -use Flarum\Core\Repository\DiscussionRepository; +use Flarum\Discussion\DiscussionRepository; use Flarum\Foundation\DispatchEventsTrait; -use Flarum\Event\DiscussionWillBeDeleted; +use Flarum\Discussion\Event\Deleting; use Illuminate\Contracts\Events\Dispatcher; class DeleteDiscussionHandler @@ -24,7 +24,7 @@ class DeleteDiscussionHandler use AssertPermissionTrait; /** - * @var DiscussionRepository + * @var \Flarum\Discussion\DiscussionRepository */ protected $discussions; @@ -40,7 +40,7 @@ class DeleteDiscussionHandler /** * @param DeleteDiscussion $command - * @return \Flarum\Core\Discussion + * @return \Flarum\Discussion\Discussion * @throws PermissionDeniedException */ public function handle(DeleteDiscussion $command) @@ -52,7 +52,7 @@ class DeleteDiscussionHandler $this->assertCan($actor, 'delete', $discussion); $this->events->fire( - new DiscussionWillBeDeleted($discussion, $actor, $command->data) + new Deleting($discussion, $actor, $command->data) ); $discussion->delete(); diff --git a/src/Core/Command/EditDiscussionHandler.php b/src/Core/Command/EditDiscussionHandler.php index 6f8e7bada..bce27933e 100644 --- a/src/Core/Command/EditDiscussionHandler.php +++ b/src/Core/Command/EditDiscussionHandler.php @@ -13,10 +13,10 @@ namespace Flarum\Core\Command; use Flarum\Core\Access\AssertPermissionTrait; use Flarum\User\Exception\PermissionDeniedException; -use Flarum\Core\Repository\DiscussionRepository; +use Flarum\Discussion\DiscussionRepository; use Flarum\Foundation\DispatchEventsTrait; -use Flarum\Core\Validator\DiscussionValidator; -use Flarum\Event\DiscussionWillBeSaved; +use Flarum\Discussion\DiscussionValidator; +use Flarum\Discussion\Event\Saving; use Illuminate\Contracts\Events\Dispatcher; class EditDiscussionHandler @@ -48,7 +48,7 @@ class EditDiscussionHandler /** * @param EditDiscussion $command - * @return \Flarum\Core\Discussion + * @return \Flarum\Discussion\Discussion * @throws \Flarum\User\Exception\PermissionDeniedException */ public function handle(EditDiscussion $command) @@ -76,7 +76,7 @@ class EditDiscussionHandler } $this->events->fire( - new DiscussionWillBeSaved($discussion, $actor, $data) + new Saving($discussion, $actor, $data) ); $this->validator->assertValid($discussion->getDirty()); diff --git a/src/Core/Command/PostReplyHandler.php b/src/Core/Command/PostReplyHandler.php index a6b327b6d..cb51c4fda 100644 --- a/src/Core/Command/PostReplyHandler.php +++ b/src/Core/Command/PostReplyHandler.php @@ -15,7 +15,7 @@ use DateTime; use Flarum\Core\Access\AssertPermissionTrait; use Flarum\Core\Notification\NotificationSyncer; use Flarum\Post\CommentPost; -use Flarum\Core\Repository\DiscussionRepository; +use Flarum\Discussion\DiscussionRepository; use Flarum\Foundation\DispatchEventsTrait; use Flarum\Post\PostValidator; use Flarum\Post\Event\Saving; diff --git a/src/Core/Command/ReadDiscussionHandler.php b/src/Core/Command/ReadDiscussionHandler.php index 0166b1439..42e4722ea 100644 --- a/src/Core/Command/ReadDiscussionHandler.php +++ b/src/Core/Command/ReadDiscussionHandler.php @@ -12,9 +12,9 @@ namespace Flarum\Core\Command; use Flarum\Core\Access\AssertPermissionTrait; -use Flarum\Core\Repository\DiscussionRepository; +use Flarum\Discussion\DiscussionRepository; use Flarum\Foundation\DispatchEventsTrait; -use Flarum\Event\DiscussionStateWillBeSaved; +use Flarum\Discussion\Event\UserDataSaving; use Illuminate\Contracts\Events\Dispatcher; class ReadDiscussionHandler @@ -54,7 +54,7 @@ class ReadDiscussionHandler $state->read($command->readNumber); $this->events->fire( - new DiscussionStateWillBeSaved($state) + new UserDataSaving($state) ); $state->save(); diff --git a/src/Core/Command/StartDiscussionHandler.php b/src/Core/Command/StartDiscussionHandler.php index e3f916f61..bad252625 100644 --- a/src/Core/Command/StartDiscussionHandler.php +++ b/src/Core/Command/StartDiscussionHandler.php @@ -13,10 +13,10 @@ namespace Flarum\Core\Command; use Exception; use Flarum\Core\Access\AssertPermissionTrait; -use Flarum\Core\Discussion; +use Flarum\Discussion\Discussion; use Flarum\Foundation\DispatchEventsTrait; -use Flarum\Core\Validator\DiscussionValidator; -use Flarum\Event\DiscussionWillBeSaved; +use Flarum\Discussion\DiscussionValidator; +use Flarum\Discussion\Event\Saving; use Illuminate\Contracts\Bus\Dispatcher as BusDispatcher; use Illuminate\Contracts\Events\Dispatcher as EventDispatcher; @@ -31,14 +31,14 @@ class StartDiscussionHandler protected $bus; /** - * @var DiscussionValidator + * @var \Flarum\Discussion\DiscussionValidator */ protected $validator; /** * @param EventDispatcher $events * @param BusDispatcher $bus - * @param DiscussionValidator $validator + * @param \Flarum\Discussion\DiscussionValidator $validator */ public function __construct(EventDispatcher $events, BusDispatcher $bus, DiscussionValidator $validator) { @@ -70,7 +70,7 @@ class StartDiscussionHandler ); $this->events->fire( - new DiscussionWillBeSaved($discussion, $actor, $data) + new Saving($discussion, $actor, $data) ); $this->validator->assertValid($discussion->getAttributes()); diff --git a/src/Core/CoreServiceProvider.php b/src/Core/CoreServiceProvider.php index c3234f488..106201d86 100644 --- a/src/Core/CoreServiceProvider.php +++ b/src/Core/CoreServiceProvider.php @@ -107,13 +107,13 @@ class CoreServiceProvider extends AbstractServiceProvider $events = $this->app->make('events'); $events->subscribe('Flarum\Core\Listener\SelfDemotionGuard'); - $events->subscribe('Flarum\Core\Listener\DiscussionMetadataUpdater'); + $events->subscribe('Flarum\Discussion\DiscussionMetadataUpdater'); $events->subscribe('Flarum\User\UserMetadataUpdater'); $events->subscribe('Flarum\Core\Listener\ExtensionValidator'); $events->subscribe('Flarum\User\EmailConfirmationMailer'); - $events->subscribe('Flarum\Core\Listener\DiscussionRenamedNotifier'); + $events->subscribe('Flarum\Discussion\DiscussionRenamedNotifier'); - $events->subscribe('Flarum\Core\Access\DiscussionPolicy'); + $events->subscribe('Flarum\Discussion\DiscussionPolicy'); $events->subscribe('Flarum\Core\Access\GroupPolicy'); $events->subscribe('Flarum\Post\PostPolicy'); $events->subscribe('Flarum\User\UserPolicy'); diff --git a/src/Core/DiscussionState.php b/src/Core/DiscussionState.php index 15b2e2142..be5e246fc 100644 --- a/src/Core/DiscussionState.php +++ b/src/Core/DiscussionState.php @@ -11,9 +11,10 @@ namespace Flarum\Core; +use Flarum\Discussion\Discussion; use Flarum\Foundation\EventGeneratorTrait; use Flarum\Database\AbstractModel; -use Flarum\Event\DiscussionWasRead; +use Flarum\Discussion\Event\UserRead; use Illuminate\Database\Eloquent\Builder; /** @@ -57,7 +58,7 @@ class DiscussionState extends AbstractModel $this->read_number = $number; $this->read_time = time(); - $this->raise(new DiscussionWasRead($this)); + $this->raise(new UserRead($this)); } return $this; @@ -70,7 +71,7 @@ class DiscussionState extends AbstractModel */ public function discussion() { - return $this->belongsTo('Flarum\Core\Discussion', 'discussion_id'); + return $this->belongsTo('Flarum\Discussion\Discussion', 'discussion_id'); } /** diff --git a/src/Core/Notification.php b/src/Core/Notification.php index 0d429998b..4429cc4b3 100644 --- a/src/Core/Notification.php +++ b/src/Core/Notification.php @@ -56,7 +56,7 @@ class Notification extends AbstractModel * A map of notification types and the model classes to use for their * subjects. For example, the 'discussionRenamed' notification type, which * represents that a user's discussion was renamed, has the subject model - * class 'Flarum\Core\Discussion'. + * class 'Flarum\Discussion\Discussion'. * * @var array */ diff --git a/src/Core/Notification/DiscussionRenamedBlueprint.php b/src/Core/Notification/DiscussionRenamedBlueprint.php index b47cac1f9..b642d82b9 100644 --- a/src/Core/Notification/DiscussionRenamedBlueprint.php +++ b/src/Core/Notification/DiscussionRenamedBlueprint.php @@ -65,6 +65,6 @@ class DiscussionRenamedBlueprint implements BlueprintInterface */ public static function getSubjectModel() { - return 'Flarum\Core\Discussion'; + return 'Flarum\Discussion\Discussion'; } } diff --git a/src/Core/Search/SearchServiceProvider.php b/src/Core/Search/SearchServiceProvider.php index 82172abb4..554a6bd7b 100644 --- a/src/Core/Search/SearchServiceProvider.php +++ b/src/Core/Search/SearchServiceProvider.php @@ -26,8 +26,8 @@ class SearchServiceProvider extends AbstractServiceProvider public function register() { $this->app->bind( - 'Flarum\Core\Search\Discussion\Fulltext\DriverInterface', - 'Flarum\Core\Search\Discussion\Fulltext\MySqlFulltextDriver' + 'Flarum\Discussion\Search\Fulltext\DriverInterface', + 'Flarum\Discussion\Search\Fulltext\MySqlFulltextDriver' ); $this->registerDiscussionGambits(); @@ -56,16 +56,16 @@ class SearchServiceProvider extends AbstractServiceProvider public function registerDiscussionGambits() { - $this->app->when('Flarum\Core\Search\Discussion\DiscussionSearcher') + $this->app->when('Flarum\Discussion\Search\DiscussionSearcher') ->needs('Flarum\Core\Search\GambitManager') ->give(function (Container $app) { $gambits = new GambitManager($app); - $gambits->setFulltextGambit('Flarum\Core\Search\Discussion\Gambit\FulltextGambit'); - $gambits->add('Flarum\Core\Search\Discussion\Gambit\AuthorGambit'); - $gambits->add('Flarum\Core\Search\Discussion\Gambit\CreatedGambit'); - $gambits->add('Flarum\Core\Search\Discussion\Gambit\HiddenGambit'); - $gambits->add('Flarum\Core\Search\Discussion\Gambit\UnreadGambit'); + $gambits->setFulltextGambit('Flarum\Discussion\Search\Gambit\FulltextGambit'); + $gambits->add('Flarum\Discussion\Search\Gambit\AuthorGambit'); + $gambits->add('Flarum\Discussion\Search\Gambit\CreatedGambit'); + $gambits->add('Flarum\Discussion\Search\Gambit\HiddenGambit'); + $gambits->add('Flarum\Discussion\Search\Gambit\UnreadGambit'); $app->make('events')->fire( new ConfigureDiscussionGambits($gambits) diff --git a/src/Core/Discussion.php b/src/Discussion/Discussion.php similarity index 95% rename from src/Core/Discussion.php rename to src/Discussion/Discussion.php index d185e8440..34122fd90 100644 --- a/src/Core/Discussion.php +++ b/src/Discussion/Discussion.php @@ -9,17 +9,18 @@ * file that was distributed with this source code. */ -namespace Flarum\Core; +namespace Flarum\Discussion; +use Flarum\Core\DiscussionState; use Flarum\Post\MergeableInterface; use Flarum\Foundation\EventGeneratorTrait; use Flarum\Database\ScopeVisibilityTrait; use Flarum\Database\AbstractModel; -use Flarum\Event\DiscussionWasDeleted; -use Flarum\Event\DiscussionWasHidden; -use Flarum\Event\DiscussionWasRenamed; -use Flarum\Event\DiscussionWasRestored; -use Flarum\Event\DiscussionWasStarted; +use Flarum\Discussion\Event\Deleted; +use Flarum\Discussion\Event\Hidden; +use Flarum\Discussion\Event\Renamed; +use Flarum\Discussion\Event\Restored; +use Flarum\Discussion\Event\Started; use Flarum\Post\Event\Deleted; use Flarum\Event\ScopePostVisibility; use Flarum\Post\Post; @@ -102,7 +103,7 @@ class Discussion extends AbstractModel parent::boot(); static::deleted(function ($discussion) { - $discussion->raise(new DiscussionWasDeleted($discussion)); + $discussion->raise(new Deleted($discussion)); // Delete all of the posts in the discussion. Before we delete them // in a big batch query, we will loop through them and raise a @@ -138,7 +139,7 @@ class Discussion extends AbstractModel $discussion->setRelation('startUser', $user); - $discussion->raise(new DiscussionWasStarted($discussion)); + $discussion->raise(new Started($discussion)); return $discussion; } @@ -155,7 +156,7 @@ class Discussion extends AbstractModel $oldTitle = $this->title; $this->title = $title; - $this->raise(new DiscussionWasRenamed($this, $oldTitle)); + $this->raise(new Renamed($this, $oldTitle)); } return $this; @@ -173,7 +174,7 @@ class Discussion extends AbstractModel $this->hide_time = time(); $this->hide_user_id = $actor ? $actor->id : null; - $this->raise(new DiscussionWasHidden($this)); + $this->raise(new Hidden($this)); } return $this; @@ -190,7 +191,7 @@ class Discussion extends AbstractModel $this->hide_time = null; $this->hide_user_id = null; - $this->raise(new DiscussionWasRestored($this)); + $this->raise(new Restored($this)); } return $this; diff --git a/src/Core/Listener/DiscussionMetadataUpdater.php b/src/Discussion/DiscussionMetadataUpdater.php similarity index 98% rename from src/Core/Listener/DiscussionMetadataUpdater.php rename to src/Discussion/DiscussionMetadataUpdater.php index ea05dba72..123d8d8c0 100755 --- a/src/Core/Listener/DiscussionMetadataUpdater.php +++ b/src/Discussion/DiscussionMetadataUpdater.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Flarum\Core\Listener; +namespace Flarum\Discussion; use Flarum\Post\Post; use Flarum\Post\Event\Deleted; diff --git a/src/Core/Access/DiscussionPolicy.php b/src/Discussion/DiscussionPolicy.php similarity index 94% rename from src/Core/Access/DiscussionPolicy.php rename to src/Discussion/DiscussionPolicy.php index 50f00a387..b43345727 100644 --- a/src/Core/Access/DiscussionPolicy.php +++ b/src/Discussion/DiscussionPolicy.php @@ -9,10 +9,10 @@ * file that was distributed with this source code. */ -namespace Flarum\Core\Access; +namespace Flarum\Discussion; use Carbon\Carbon; -use Flarum\Core\Discussion; +use Flarum\Discussion\Discussion; use Flarum\Event\ScopeHiddenDiscussionVisibility; use Flarum\Event\ScopePrivateDiscussionVisibility; use Flarum\Settings\SettingsRepositoryInterface; @@ -100,7 +100,7 @@ class DiscussionPolicy extends AbstractPolicy /** * @param User $actor - * @param Discussion $discussion + * @param \Flarum\Discussion\Discussion $discussion * @return bool|null */ public function rename(User $actor, Discussion $discussion) @@ -118,7 +118,7 @@ class DiscussionPolicy extends AbstractPolicy /** * @param User $actor - * @param Discussion $discussion + * @param \Flarum\Discussion\Discussion $discussion * @return bool|null */ public function hide(User $actor, Discussion $discussion) diff --git a/src/Core/Listener/DiscussionRenamedNotifier.php b/src/Discussion/DiscussionRenamedNotifier.php similarity index 83% rename from src/Core/Listener/DiscussionRenamedNotifier.php rename to src/Discussion/DiscussionRenamedNotifier.php index 1357b1948..2cd8bdc9c 100755 --- a/src/Core/Listener/DiscussionRenamedNotifier.php +++ b/src/Discussion/DiscussionRenamedNotifier.php @@ -9,12 +9,12 @@ * file that was distributed with this source code. */ -namespace Flarum\Core\Listener; +namespace Flarum\Discussion; use Flarum\Core\Notification\DiscussionRenamedBlueprint; use Flarum\Core\Notification\NotificationSyncer; use Flarum\Post\DiscussionRenamedPost; -use Flarum\Event\DiscussionWasRenamed; +use Flarum\Discussion\Event\Renamed; use Illuminate\Contracts\Events\Dispatcher; class DiscussionRenamedNotifier @@ -37,13 +37,13 @@ class DiscussionRenamedNotifier */ public function subscribe(Dispatcher $events) { - $events->listen(DiscussionWasRenamed::class, [$this, 'whenDiscussionWasRenamed']); + $events->listen(Renamed::class, [$this, 'whenDiscussionWasRenamed']); } /** - * @param \Flarum\Event\DiscussionWasRenamed $event + * @param \Flarum\Discussion\Event\Renamed $event */ - public function whenDiscussionWasRenamed(DiscussionWasRenamed $event) + public function whenDiscussionWasRenamed(Renamed $event) { $post = DiscussionRenamedPost::reply( $event->discussion->id, diff --git a/src/Core/Repository/DiscussionRepository.php b/src/Discussion/DiscussionRepository.php similarity index 94% rename from src/Core/Repository/DiscussionRepository.php rename to src/Discussion/DiscussionRepository.php index add4f2b30..11c64664a 100644 --- a/src/Core/Repository/DiscussionRepository.php +++ b/src/Discussion/DiscussionRepository.php @@ -9,9 +9,8 @@ * file that was distributed with this source code. */ -namespace Flarum\Core\Repository; +namespace Flarum\Discussion; -use Flarum\Core\Discussion; use Flarum\User\User; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Query\Expression; @@ -34,7 +33,7 @@ class DiscussionRepository * * @param int $id * @param User $user - * @return \Flarum\Core\Discussion + * @return \Flarum\Discussion\Discussion */ public function findOrFail($id, User $user = null) { diff --git a/src/Core/Validator/DiscussionValidator.php b/src/Discussion/DiscussionValidator.php similarity index 93% rename from src/Core/Validator/DiscussionValidator.php rename to src/Discussion/DiscussionValidator.php index 2c2a90818..1511cd55d 100644 --- a/src/Core/Validator/DiscussionValidator.php +++ b/src/Discussion/DiscussionValidator.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Flarum\Core\Validator; +namespace Flarum\Discussion; use Flarum\Foundation\AbstractValidator; diff --git a/src/Event/DiscussionWasDeleted.php b/src/Discussion/Event/Deleted.php similarity index 75% rename from src/Event/DiscussionWasDeleted.php rename to src/Discussion/Event/Deleted.php index f57193918..d4b21bf87 100644 --- a/src/Event/DiscussionWasDeleted.php +++ b/src/Discussion/Event/Deleted.php @@ -9,15 +9,15 @@ * file that was distributed with this source code. */ -namespace Flarum\Event; +namespace Flarum\Discussion\Event; -use Flarum\Core\Discussion; +use Flarum\Discussion\Discussion; use Flarum\User\User; -class DiscussionWasDeleted +class Deleted { /** - * @var Discussion + * @var \Flarum\Discussion\Discussion */ public $discussion; @@ -27,7 +27,7 @@ class DiscussionWasDeleted public $actor; /** - * @param Discussion $discussion + * @param \Flarum\Discussion\Discussion $discussion * @param User $actor */ public function __construct(Discussion $discussion, User $actor = null) diff --git a/src/Event/DiscussionWillBeDeleted.php b/src/Discussion/Event/Deleting.php similarity index 91% rename from src/Event/DiscussionWillBeDeleted.php rename to src/Discussion/Event/Deleting.php index d70e399fe..93f432192 100644 --- a/src/Event/DiscussionWillBeDeleted.php +++ b/src/Discussion/Event/Deleting.php @@ -9,12 +9,12 @@ * file that was distributed with this source code. */ -namespace Flarum\Event; +namespace Flarum\Discussion\Event; -use Flarum\Core\Discussion; +use Flarum\Discussion\Discussion; use Flarum\User\User; -class DiscussionWillBeDeleted +class Deleting { /** * The discussion that is going to be deleted. diff --git a/src/Event/DiscussionWasStarted.php b/src/Discussion/Event/Hidden.php similarity index 75% rename from src/Event/DiscussionWasStarted.php rename to src/Discussion/Event/Hidden.php index b35ed7851..6a2095a74 100644 --- a/src/Event/DiscussionWasStarted.php +++ b/src/Discussion/Event/Hidden.php @@ -9,15 +9,15 @@ * file that was distributed with this source code. */ -namespace Flarum\Event; +namespace Flarum\Discussion\Event; -use Flarum\Core\Discussion; +use Flarum\Discussion\Discussion; use Flarum\User\User; -class DiscussionWasStarted +class Hidden { /** - * @var Discussion + * @var \Flarum\Discussion\Discussion */ public $discussion; @@ -27,7 +27,7 @@ class DiscussionWasStarted public $actor; /** - * @param Discussion $discussion + * @param \Flarum\Discussion\Discussion $discussion * @param User $actor */ public function __construct(Discussion $discussion, User $actor = null) diff --git a/src/Event/DiscussionWasRenamed.php b/src/Discussion/Event/Renamed.php similarity index 83% rename from src/Event/DiscussionWasRenamed.php rename to src/Discussion/Event/Renamed.php index 7d71a20ed..3d06b959b 100644 --- a/src/Event/DiscussionWasRenamed.php +++ b/src/Discussion/Event/Renamed.php @@ -9,12 +9,12 @@ * file that was distributed with this source code. */ -namespace Flarum\Event; +namespace Flarum\Discussion\Event; -use Flarum\Core\Discussion; +use Flarum\Discussion\Discussion; use Flarum\User\User; -class DiscussionWasRenamed +class Renamed { /** * @var Discussion @@ -32,7 +32,7 @@ class DiscussionWasRenamed public $actor; /** - * @param Discussion $discussion + * @param \Flarum\Discussion\Discussion $discussion * @param User $actor * @param string $oldTitle */ diff --git a/src/Event/DiscussionWasRestored.php b/src/Discussion/Event/Restored.php similarity index 75% rename from src/Event/DiscussionWasRestored.php rename to src/Discussion/Event/Restored.php index 22135b6ee..eb276e755 100644 --- a/src/Event/DiscussionWasRestored.php +++ b/src/Discussion/Event/Restored.php @@ -9,15 +9,15 @@ * file that was distributed with this source code. */ -namespace Flarum\Event; +namespace Flarum\Discussion\Event; -use Flarum\Core\Discussion; +use Flarum\Discussion\Discussion; use Flarum\User\User; -class DiscussionWasRestored +class Restored { /** - * @var Discussion + * @var \Flarum\Discussion\Discussion */ public $discussion; @@ -27,7 +27,7 @@ class DiscussionWasRestored public $actor; /** - * @param Discussion $discussion + * @param \Flarum\Discussion\Discussion $discussion * @param User $actor */ public function __construct(Discussion $discussion, User $actor = null) diff --git a/src/Event/DiscussionWillBeSaved.php b/src/Discussion/Event/Saving.php similarity index 82% rename from src/Event/DiscussionWillBeSaved.php rename to src/Discussion/Event/Saving.php index 3d15ff4cc..e6d25a0ae 100644 --- a/src/Event/DiscussionWillBeSaved.php +++ b/src/Discussion/Event/Saving.php @@ -9,17 +9,17 @@ * file that was distributed with this source code. */ -namespace Flarum\Event; +namespace Flarum\Discussion\Event; -use Flarum\Core\Discussion; +use Flarum\Discussion\Discussion; use Flarum\User\User; -class DiscussionWillBeSaved +class Saving { /** * The discussion that will be saved. * - * @var Discussion + * @var \Flarum\Discussion\Discussion */ public $discussion; @@ -38,7 +38,7 @@ class DiscussionWillBeSaved public $data; /** - * @param Discussion $discussion + * @param \Flarum\Discussion\Discussion $discussion * @param User $actor * @param array $data */ diff --git a/src/Event/DiscussionWasHidden.php b/src/Discussion/Event/Started.php similarity index 75% rename from src/Event/DiscussionWasHidden.php rename to src/Discussion/Event/Started.php index b99b3e03b..ddb640662 100644 --- a/src/Event/DiscussionWasHidden.php +++ b/src/Discussion/Event/Started.php @@ -9,15 +9,15 @@ * file that was distributed with this source code. */ -namespace Flarum\Event; +namespace Flarum\Discussion\Event; -use Flarum\Core\Discussion; +use Flarum\Discussion\Discussion; use Flarum\User\User; -class DiscussionWasHidden +class Started { /** - * @var Discussion + * @var \Flarum\Discussion\Discussion */ public $discussion; @@ -27,7 +27,7 @@ class DiscussionWasHidden public $actor; /** - * @param Discussion $discussion + * @param \Flarum\Discussion\Discussion $discussion * @param User $actor */ public function __construct(Discussion $discussion, User $actor = null) diff --git a/src/Event/DiscussionStateWillBeSaved.php b/src/Discussion/Event/UserDataSaving.php similarity index 89% rename from src/Event/DiscussionStateWillBeSaved.php rename to src/Discussion/Event/UserDataSaving.php index 05ddd45cc..1574b44b6 100644 --- a/src/Event/DiscussionStateWillBeSaved.php +++ b/src/Discussion/Event/UserDataSaving.php @@ -9,11 +9,11 @@ * file that was distributed with this source code. */ -namespace Flarum\Event; +namespace Flarum\Discussion\Event; use Flarum\Core\DiscussionState; -class DiscussionStateWillBeSaved +class UserDataSaving { /** * @var DiscussionState diff --git a/src/Event/DiscussionWasRead.php b/src/Discussion/Event/UserRead.php similarity index 90% rename from src/Event/DiscussionWasRead.php rename to src/Discussion/Event/UserRead.php index cf8936310..8baf3fc31 100644 --- a/src/Event/DiscussionWasRead.php +++ b/src/Discussion/Event/UserRead.php @@ -9,11 +9,11 @@ * file that was distributed with this source code. */ -namespace Flarum\Event; +namespace Flarum\Discussion\Event; use Flarum\Core\DiscussionState; -class DiscussionWasRead +class UserRead { /** * @var DiscussionState diff --git a/src/Core/Search/Discussion/DiscussionSearch.php b/src/Discussion/Search/DiscussionSearch.php similarity index 96% rename from src/Core/Search/Discussion/DiscussionSearch.php rename to src/Discussion/Search/DiscussionSearch.php index 8b1324cf8..bde618ef1 100644 --- a/src/Core/Search/Discussion/DiscussionSearch.php +++ b/src/Discussion/Search/DiscussionSearch.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Flarum\Core\Search\Discussion; +namespace Flarum\Discussion\Search; use Flarum\Core\Search\AbstractSearch; diff --git a/src/Core/Search/Discussion/DiscussionSearcher.php b/src/Discussion/Search/DiscussionSearcher.php similarity index 96% rename from src/Core/Search/Discussion/DiscussionSearcher.php rename to src/Discussion/Search/DiscussionSearcher.php index f606d99c2..aacce651d 100644 --- a/src/Core/Search/Discussion/DiscussionSearcher.php +++ b/src/Discussion/Search/DiscussionSearcher.php @@ -9,10 +9,11 @@ * file that was distributed with this source code. */ -namespace Flarum\Core\Search\Discussion; +namespace Flarum\Discussion\Search; -use Flarum\Core\Discussion; -use Flarum\Core\Repository\DiscussionRepository; +use Flarum\Discussion\Discussion; +use Flarum\Discussion\DiscussionRepository; +use Flarum\Discussion\Search\DiscussionSearch; use Flarum\Post\PostRepository; use Flarum\Core\Search\ApplySearchParametersTrait; use Flarum\Core\Search\GambitManager; diff --git a/src/Core/Search/Discussion/Fulltext/DriverInterface.php b/src/Discussion/Search/Fulltext/DriverInterface.php similarity index 90% rename from src/Core/Search/Discussion/Fulltext/DriverInterface.php rename to src/Discussion/Search/Fulltext/DriverInterface.php index da90c44a0..bfcd37093 100644 --- a/src/Core/Search/Discussion/Fulltext/DriverInterface.php +++ b/src/Discussion/Search/Fulltext/DriverInterface.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Flarum\Core\Search\Discussion\Fulltext; +namespace Flarum\Discussion\Search\Fulltext; interface DriverInterface { diff --git a/src/Core/Search/Discussion/Fulltext/MySqlFulltextDriver.php b/src/Discussion/Search/Fulltext/MySqlFulltextDriver.php similarity index 94% rename from src/Core/Search/Discussion/Fulltext/MySqlFulltextDriver.php rename to src/Discussion/Search/Fulltext/MySqlFulltextDriver.php index 402fefc4c..8c71066d6 100644 --- a/src/Core/Search/Discussion/Fulltext/MySqlFulltextDriver.php +++ b/src/Discussion/Search/Fulltext/MySqlFulltextDriver.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Flarum\Core\Search\Discussion\Fulltext; +namespace Flarum\Discussion\Search\Fulltext; use Flarum\Core\Post; diff --git a/src/Core/Search/Discussion/Gambit/AuthorGambit.php b/src/Discussion/Search/Gambit/AuthorGambit.php similarity index 93% rename from src/Core/Search/Discussion/Gambit/AuthorGambit.php rename to src/Discussion/Search/Gambit/AuthorGambit.php index d1336efec..10492e981 100644 --- a/src/Core/Search/Discussion/Gambit/AuthorGambit.php +++ b/src/Discussion/Search/Gambit/AuthorGambit.php @@ -9,12 +9,12 @@ * file that was distributed with this source code. */ -namespace Flarum\Core\Search\Discussion\Gambit; +namespace Flarum\Discussion\Search\Gambit; use Flarum\User\UserRepository; use Flarum\Core\Search\AbstractRegexGambit; use Flarum\Core\Search\AbstractSearch; -use Flarum\Core\Search\Discussion\DiscussionSearch; +use Flarum\Discussion\Search\DiscussionSearch; use LogicException; class AuthorGambit extends AbstractRegexGambit diff --git a/src/Core/Search/Discussion/Gambit/CreatedGambit.php b/src/Discussion/Search/Gambit/CreatedGambit.php similarity index 93% rename from src/Core/Search/Discussion/Gambit/CreatedGambit.php rename to src/Discussion/Search/Gambit/CreatedGambit.php index e47bedfc4..244930d45 100644 --- a/src/Core/Search/Discussion/Gambit/CreatedGambit.php +++ b/src/Discussion/Search/Gambit/CreatedGambit.php @@ -9,11 +9,11 @@ * file that was distributed with this source code. */ -namespace Flarum\Core\Search\Discussion\Gambit; +namespace Flarum\Discussion\Search\Gambit; use Flarum\Core\Search\AbstractRegexGambit; use Flarum\Core\Search\AbstractSearch; -use Flarum\Core\Search\Discussion\DiscussionSearch; +use Flarum\Discussion\Search\DiscussionSearch; use LogicException; class CreatedGambit extends AbstractRegexGambit diff --git a/src/Core/Search/Discussion/Gambit/FulltextGambit.php b/src/Discussion/Search/Gambit/FulltextGambit.php similarity index 79% rename from src/Core/Search/Discussion/Gambit/FulltextGambit.php rename to src/Discussion/Search/Gambit/FulltextGambit.php index 6531ba915..f28ccf412 100644 --- a/src/Core/Search/Discussion/Gambit/FulltextGambit.php +++ b/src/Discussion/Search/Gambit/FulltextGambit.php @@ -9,23 +9,23 @@ * file that was distributed with this source code. */ -namespace Flarum\Core\Search\Discussion\Gambit; +namespace Flarum\Discussion\Search\Gambit; use Flarum\Core\Search\AbstractSearch; -use Flarum\Core\Search\Discussion\DiscussionSearch; -use Flarum\Core\Search\Discussion\Fulltext\DriverInterface; +use Flarum\Discussion\Search\DiscussionSearch; +use Flarum\Discussion\Search\Fulltext\DriverInterface; use Flarum\Core\Search\GambitInterface; use LogicException; class FulltextGambit implements GambitInterface { /** - * @var DriverInterface + * @var \Flarum\Discussion\Search\Fulltext\DriverInterface */ protected $fulltext; /** - * @param DriverInterface $fulltext + * @param \Flarum\Discussion\Search\Fulltext\DriverInterface $fulltext */ public function __construct(DriverInterface $fulltext) { diff --git a/src/Core/Search/Discussion/Gambit/HiddenGambit.php b/src/Discussion/Search/Gambit/HiddenGambit.php similarity index 91% rename from src/Core/Search/Discussion/Gambit/HiddenGambit.php rename to src/Discussion/Search/Gambit/HiddenGambit.php index c27bf457a..99c544741 100644 --- a/src/Core/Search/Discussion/Gambit/HiddenGambit.php +++ b/src/Discussion/Search/Gambit/HiddenGambit.php @@ -9,11 +9,11 @@ * file that was distributed with this source code. */ -namespace Flarum\Core\Search\Discussion\Gambit; +namespace Flarum\Discussion\Search\Gambit; use Flarum\Core\Search\AbstractRegexGambit; use Flarum\Core\Search\AbstractSearch; -use Flarum\Core\Search\Discussion\DiscussionSearch; +use Flarum\Discussion\Search\DiscussionSearch; use LogicException; class HiddenGambit extends AbstractRegexGambit diff --git a/src/Core/Search/Discussion/Gambit/UnreadGambit.php b/src/Discussion/Search/Gambit/UnreadGambit.php similarity index 85% rename from src/Core/Search/Discussion/Gambit/UnreadGambit.php rename to src/Discussion/Search/Gambit/UnreadGambit.php index 9c7890095..29f3b2f10 100644 --- a/src/Core/Search/Discussion/Gambit/UnreadGambit.php +++ b/src/Discussion/Search/Gambit/UnreadGambit.php @@ -9,12 +9,12 @@ * file that was distributed with this source code. */ -namespace Flarum\Core\Search\Discussion\Gambit; +namespace Flarum\Discussion\Search\Gambit; -use Flarum\Core\Repository\DiscussionRepository; +use Flarum\Discussion\DiscussionRepository; use Flarum\Core\Search\AbstractRegexGambit; use Flarum\Core\Search\AbstractSearch; -use Flarum\Core\Search\Discussion\DiscussionSearch; +use Flarum\Discussion\Search\DiscussionSearch; use LogicException; class UnreadGambit extends AbstractRegexGambit @@ -25,12 +25,12 @@ class UnreadGambit extends AbstractRegexGambit protected $pattern = 'is:unread'; /** - * @var \Flarum\Core\Repository\DiscussionRepository + * @var \Flarum\Discussion\DiscussionRepository */ protected $discussions; /** - * @param DiscussionRepository $discussions + * @param \Flarum\Discussion\DiscussionRepository $discussions */ public function __construct(DiscussionRepository $discussions) { diff --git a/src/Event/ConfigureDiscussionSearch.php b/src/Event/ConfigureDiscussionSearch.php index 90ff9b1a0..f86d29fea 100644 --- a/src/Event/ConfigureDiscussionSearch.php +++ b/src/Event/ConfigureDiscussionSearch.php @@ -11,7 +11,7 @@ namespace Flarum\Event; -use Flarum\Core\Search\Discussion\DiscussionSearch; +use Flarum\Discussion\Search\DiscussionSearch; use Flarum\Core\Search\SearchCriteria; class ConfigureDiscussionSearch diff --git a/src/Event/ScopePostVisibility.php b/src/Event/ScopePostVisibility.php index 16c488903..d8d2304e2 100644 --- a/src/Event/ScopePostVisibility.php +++ b/src/Event/ScopePostVisibility.php @@ -11,7 +11,7 @@ namespace Flarum\Event; -use Flarum\Core\Discussion; +use Flarum\Discussion\Discussion; use Flarum\User\User; use Illuminate\Database\Eloquent\Builder; @@ -21,7 +21,7 @@ use Illuminate\Database\Eloquent\Builder; class ScopePostVisibility { /** - * @var Discussion + * @var \Flarum\Discussion\Discussion */ public $discussion; diff --git a/src/Event/ScopePrivatePostVisibility.php b/src/Event/ScopePrivatePostVisibility.php index 1339e5f27..bb84cda39 100644 --- a/src/Event/ScopePrivatePostVisibility.php +++ b/src/Event/ScopePrivatePostVisibility.php @@ -11,7 +11,7 @@ namespace Flarum\Event; -use Flarum\Core\Discussion; +use Flarum\Discussion\Discussion; use Flarum\User\User; use Illuminate\Database\Eloquent\Builder; @@ -21,7 +21,7 @@ use Illuminate\Database\Eloquent\Builder; class ScopePrivatePostVisibility { /** - * @var Discussion + * @var \Flarum\Discussion\Discussion */ public $discussion; @@ -36,7 +36,7 @@ class ScopePrivatePostVisibility public $actor; /** - * @param Discussion $discussion + * @param \Flarum\Discussion\Discussion $discussion * @param Builder $query * @param User $actor */ diff --git a/src/Post/Post.php b/src/Post/Post.php index ab081b6a6..468a708fb 100755 --- a/src/Post/Post.php +++ b/src/Post/Post.php @@ -30,7 +30,7 @@ use Illuminate\Database\Eloquent\Builder; * @property int|null $edit_user_id * @property \Carbon\Carbon|null $hide_time * @property int|null $hide_user_id - * @property \Flarum\Core\Discussion|null $discussion + * @property \Flarum\Discussion\Discussion|null $discussion * @property User|null $user * @property User|null $editUser * @property User|null $hideUser @@ -129,7 +129,7 @@ class Post extends AbstractModel */ public function discussion() { - return $this->belongsTo('Flarum\Core\Discussion', 'discussion_id'); + return $this->belongsTo('Flarum\Discussion\Discussion', 'discussion_id'); } /** diff --git a/src/Post/PostRepository.php b/src/Post/PostRepository.php index b9560be91..a43ce300c 100644 --- a/src/Post/PostRepository.php +++ b/src/Post/PostRepository.php @@ -11,7 +11,7 @@ namespace Flarum\Post; -use Flarum\Core\Discussion; +use Flarum\Discussion\Discussion; use Flarum\Event\ScopePostVisibility; use Flarum\User\User; use Illuminate\Database\Eloquent\ModelNotFoundException; diff --git a/src/User/User.php b/src/User/User.php index dfb81d60d..f85470449 100755 --- a/src/User/User.php +++ b/src/User/User.php @@ -613,7 +613,7 @@ class User extends AbstractModel */ public function read() { - return $this->belongsToMany('Flarum\Core\Discussion', 'users_discussions'); + return $this->belongsToMany('Flarum\Discussion\Discussion', 'users_discussions'); } /** diff --git a/src/User/UserMetadataUpdater.php b/src/User/UserMetadataUpdater.php index 3e8af5404..3cf33979a 100755 --- a/src/User/UserMetadataUpdater.php +++ b/src/User/UserMetadataUpdater.php @@ -11,10 +11,10 @@ namespace Flarum\User; -use Flarum\Core\Discussion; +use Flarum\Discussion\Discussion; use Flarum\Core\Post; -use Flarum\Event\DiscussionWasDeleted; -use Flarum\Event\DiscussionWasStarted; +use Flarum\Discussion\Event\Deleted; +use Flarum\Discussion\Event\Started; use Flarum\Post\Event\Deleted; use Flarum\Post\Event\Hidden; use Flarum\Post\Event\Posted; @@ -32,8 +32,8 @@ class UserMetadataUpdater $events->listen(Deleted::class, [$this, 'whenPostWasDeleted']); $events->listen(Hidden::class, [$this, 'whenPostWasHidden']); $events->listen(Restored::class, [$this, 'whenPostWasRestored']); - $events->listen(DiscussionWasStarted::class, [$this, 'whenDiscussionWasStarted']); - $events->listen(DiscussionWasDeleted::class, [$this, 'whenDiscussionWasDeleted']); + $events->listen(Started::class, [$this, 'whenDiscussionWasStarted']); + $events->listen(Deleted::class, [$this, 'whenDiscussionWasDeleted']); } /** @@ -69,17 +69,17 @@ class UserMetadataUpdater } /** - * @param \Flarum\Event\DiscussionWasStarted $event + * @param \Flarum\Discussion\Event\Started $event */ - public function whenDiscussionWasStarted(DiscussionWasStarted $event) + public function whenDiscussionWasStarted(Started $event) { $this->updateDiscussionsCount($event->discussion, 1); } /** - * @param \Flarum\Event\DiscussionWasDeleted $event + * @param \Flarum\Discussion\Event\Deleted $event */ - public function whenDiscussionWasDeleted(DiscussionWasDeleted $event) + public function whenDiscussionWasDeleted(Deleted $event) { $this->updateDiscussionsCount($event->discussion, -1); } @@ -99,7 +99,7 @@ class UserMetadataUpdater } /** - * @param Discussion $discussion + * @param \Flarum\Discussion\Discussion $discussion * @param int $amount */ protected function updateDiscussionsCount(Discussion $discussion, $amount)