Move UserState class to Flarum\Discussion namespace

This commit is contained in:
Franz Liedke 2017-06-24 14:24:42 +02:00
parent b38ade986d
commit 8a16c1ecc8
No known key found for this signature in database
GPG Key ID: 9A0231A879B055F4
5 changed files with 16 additions and 16 deletions

View File

@ -39,7 +39,7 @@ class ReadDiscussionHandler
/**
* @param ReadDiscussion $command
* @return \Flarum\Core\DiscussionState
* @return \Flarum\Discussion\UserState
* @throws \Flarum\User\Exception\PermissionDeniedException
*/
public function handle(ReadDiscussion $command)

View File

@ -11,7 +11,7 @@
namespace Flarum\Discussion;
use Flarum\Core\DiscussionState;
use Flarum\Discussion\UserState;
use Flarum\Post\MergeableInterface;
use Flarum\Foundation\EventGeneratorTrait;
use Flarum\Database\ScopeVisibilityTrait;
@ -44,7 +44,7 @@ use Flarum\Util\Str;
* @property int|null $last_post_number
* @property \Carbon\Carbon|null $hide_time
* @property int|null $hide_user_id
* @property DiscussionState|null $state
* @property UserState|null $state
* @property \Illuminate\Database\Eloquent\Collection $posts
* @property \Illuminate\Database\Eloquent\Collection $comments
* @property \Illuminate\Database\Eloquent\Collection $participants
@ -416,7 +416,7 @@ class Discussion extends AbstractModel
{
$user = $user ?: static::$stateUser;
return $this->hasOne('Flarum\Core\DiscussionState')->where('user_id', $user ? $user->id : null);
return $this->hasOne('Flarum\Discussion\UserState')->where('user_id', $user ? $user->id : null);
}
/**
@ -424,14 +424,14 @@ class Discussion extends AbstractModel
* exist.
*
* @param User $user
* @return \Flarum\Core\DiscussionState
* @return \Flarum\Discussion\UserState
*/
public function stateFor(User $user)
{
$state = $this->state($user)->first();
if (! $state) {
$state = new DiscussionState;
$state = new UserState;
$state->discussion_id = $this->id;
$state->user_id = $user->id;
}

View File

@ -11,19 +11,19 @@
namespace Flarum\Discussion\Event;
use Flarum\Core\DiscussionState;
use Flarum\Discussion\UserState;
class UserDataSaving
{
/**
* @var DiscussionState
* @var \Flarum\Discussion\UserState
*/
public $state;
/**
* @param DiscussionState $state
* @param \Flarum\Discussion\UserState $state
*/
public function __construct(DiscussionState $state)
public function __construct(UserState $state)
{
$this->state = $state;
}

View File

@ -11,19 +11,19 @@
namespace Flarum\Discussion\Event;
use Flarum\Core\DiscussionState;
use Flarum\Discussion\UserState;
class UserRead
{
/**
* @var DiscussionState
* @var UserState
*/
public $state;
/**
* @param DiscussionState $state
* @param UserState $state
*/
public function __construct(DiscussionState $state)
public function __construct(UserState $state)
{
$this->state = $state;
}

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Flarum\Core;
namespace Flarum\Discussion;
use Flarum\Discussion\Discussion;
use Flarum\Foundation\EventGeneratorTrait;
@ -31,7 +31,7 @@ use Illuminate\Database\Eloquent\Builder;
* @property Discussion $discussion
* @property \Flarum\User\User $user
*/
class DiscussionState extends AbstractModel
class UserState extends AbstractModel
{
use EventGeneratorTrait;