mirror of
https://github.com/flarum/core.git
synced 2025-10-10 06:24:26 +02:00
Massive refactor
- Use contextual namespaces within Flarum\Core - Clean up and docblock everything - Refactor Activity/Notification blueprint stuff - Refactor Formatter stuff - Refactor Search stuff - Upgrade to JSON-API 1.0 - Removed “addedPosts” and “removedPosts” relationships from discussion API. This was used for adding/removing event posts after renaming a discussion etc. Instead we should make an additional request to get all new posts Todo: - Fix Extenders and extensions - Get rid of repository interfaces - Fix other bugs I’ve inevitably introduced
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<?php namespace Flarum\Api\Actions\Users;
|
||||
|
||||
use Flarum\Core\Repositories\UserRepositoryInterface;
|
||||
use Flarum\Core\Users\UserRepositoryInterface;
|
||||
use Flarum\Api\Actions\SerializeResourceAction;
|
||||
use Flarum\Api\JsonApiRequest;
|
||||
use Tobscure\JsonApi\Document;
|
||||
@@ -8,7 +8,7 @@ use Tobscure\JsonApi\Document;
|
||||
class ShowAction extends SerializeResourceAction
|
||||
{
|
||||
/**
|
||||
* @var \Flarum\Core\Repositories\UserRepositoryInterface
|
||||
* @var UserRepositoryInterface
|
||||
*/
|
||||
protected $users;
|
||||
|
||||
@@ -50,9 +50,7 @@ class ShowAction extends SerializeResourceAction
|
||||
public static $sort;
|
||||
|
||||
/**
|
||||
* Instantiate the action.
|
||||
*
|
||||
* @param \Flarum\Core\Repositories\UserRepositoryInterface $users
|
||||
* @param UserRepositoryInterface $users
|
||||
*/
|
||||
public function __construct(UserRepositoryInterface $users)
|
||||
{
|
||||
@@ -63,9 +61,9 @@ class ShowAction extends SerializeResourceAction
|
||||
* Get a single user, ready to be serialized and assigned to the JsonApi
|
||||
* response.
|
||||
*
|
||||
* @param \Flarum\Api\JsonApiRequest $request
|
||||
* @param \Tobscure\JsonApi\Document $document
|
||||
* @return \Flarum\Core\Models\Discussion
|
||||
* @param JsonApiRequest $request
|
||||
* @param Document $document
|
||||
* @return \Flarum\Core\Users\User
|
||||
*/
|
||||
protected function data(JsonApiRequest $request, Document $document)
|
||||
{
|
||||
@@ -75,6 +73,6 @@ class ShowAction extends SerializeResourceAction
|
||||
$id = $this->users->getIdForUsername($id);
|
||||
}
|
||||
|
||||
return $this->users->findOrFail($id, $request->actor->getUser());
|
||||
return $this->users->findOrFail($id, $request->actor);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user