mirror of
https://github.com/flarum/core.git
synced 2025-10-10 22:44:25 +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:
@@ -63,8 +63,8 @@ abstract class SerializeAction extends JsonApiAction
|
||||
/**
|
||||
* Handle an API request and return an API response.
|
||||
*
|
||||
* @param \Flarum\Api\Request $request
|
||||
* @return \Psr\Http\Message\ResponseInterface
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function respond(Request $request)
|
||||
{
|
||||
@@ -78,14 +78,15 @@ abstract class SerializeAction extends JsonApiAction
|
||||
$serializer = new static::$serializer($request->actor, $request->include, $request->link);
|
||||
|
||||
$document->setData($this->serialize($serializer, $data));
|
||||
|
||||
return new JsonResponse($document, 200, ['content-type' => 'application/vnd.api+json']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the data to be serialized and assigned to the response document.
|
||||
*
|
||||
* @param \Flarum\Api\JsonApiRequest $request
|
||||
* @param \Tobscure\JsonApi\Document $document
|
||||
* @param JsonApiRequest $request
|
||||
* @param Document $document
|
||||
* @return array
|
||||
*/
|
||||
abstract protected function data(JsonApiRequest $request, Document $document);
|
||||
@@ -93,7 +94,7 @@ abstract class SerializeAction extends JsonApiAction
|
||||
/**
|
||||
* Serialize the data as appropriate.
|
||||
*
|
||||
* @param \Tobscure\JsonApi\SerializerInterface $serializer
|
||||
* @param SerializerInterface $serializer
|
||||
* @param array $data
|
||||
* @return \Tobscure\JsonApi\Elements\ElementInterface
|
||||
*/
|
||||
@@ -103,8 +104,8 @@ abstract class SerializeAction extends JsonApiAction
|
||||
* Extract parameters from the request input and assign them to the
|
||||
* request, restricted by the action's specifications.
|
||||
*
|
||||
* @param \Flarum\Api\Request $request
|
||||
* @return void
|
||||
* @param Request $request
|
||||
* @return JsonApiRequest
|
||||
*/
|
||||
protected static function buildJsonApiRequest(Request $request)
|
||||
{
|
||||
@@ -160,8 +161,8 @@ abstract class SerializeAction extends JsonApiAction
|
||||
* Add pagination links to a JSON-API response, based on input parameters
|
||||
* and the default parameters of this action.
|
||||
*
|
||||
* @param \Tobscure\JsonApi\Document $document
|
||||
* @param \Flarum\Api\JsonApiRequest $request
|
||||
* @param Document $document
|
||||
* @param JsonApiRequest $request
|
||||
* @param string $url The base URL to build pagination links with.
|
||||
* @param integer|boolean $total The total number of results (used to build
|
||||
* a 'last' link), or just true if there are more results but how many
|
||||
|
Reference in New Issue
Block a user