mirror of
https://github.com/flarum/core.git
synced 2025-10-15 00:44:40 +02:00
Upgrade to JSON-API RC3 + latest version of tobscure/json-api
Note: npm source for ember-json-api changed to a fork, but I still had to apply a custom change to get polymorphic relationships to work (see https://github.com/kurko/ember-json-api/pull/71#issuecomment-85257281)
This commit is contained in:
@@ -18,9 +18,9 @@ class CreateAction extends BaseAction
|
||||
// required attributes of a user is the username, email, and password.
|
||||
// Let's set up a command with this information. We also fire an event
|
||||
// to allow plugins to add data to the command.
|
||||
$username = $params->get('users.username');
|
||||
$email = $params->get('users.email');
|
||||
$password = $params->get('users.password');
|
||||
$username = $params->get('data.username');
|
||||
$email = $params->get('data.email');
|
||||
$password = $params->get('data.password');
|
||||
|
||||
$command = new RegisterUserCommand($username, $email, $password, $this->actor->getUser(), app('flarum.forum'));
|
||||
$user = $this->dispatch($command, $params);
|
||||
@@ -29,7 +29,7 @@ class CreateAction extends BaseAction
|
||||
// would have thrown an exception if not.) We set this post as our
|
||||
// document's primary element.
|
||||
$serializer = new UserSerializer;
|
||||
$document = $this->document()->setPrimaryElement($serializer->resource($user));
|
||||
$document = $this->document()->setData($serializer->resource($user));
|
||||
|
||||
return $this->respondWithDocument($document, 201);
|
||||
}
|
||||
|
Reference in New Issue
Block a user