Skip to content

Commit

Permalink
Remove AssertPermissionTrait
Browse files Browse the repository at this point in the history
  • Loading branch information
karaok491 committed Dec 4, 2020
1 parent 1c9e602 commit 6ddf32b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"type": "flarum-extension",
"license": "MIT",
"require": {
"flarum/core": "^0.1.0-beta.14",
"flarum/core": ">=0.1.0-beta.14 <0.1.0-beta.15",
"flarum/tags": "^0.1.0-beta.14",
"fof/components": ">=0.2.0",
"fof/extend": ">=0.3.1"
Expand Down
9 changes: 5 additions & 4 deletions src/Controllers/ChangeTagSubscription.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,13 @@
use Flarum\Api\Controller\AbstractShowController;
use Flarum\Tags\Api\Serializer\TagSerializer;
use Flarum\Tags\Tag;
use Flarum\User\AssertPermissionTrait;
use Flarum\User\User;
use Illuminate\Support\Arr;
use Psr\Http\Message\ServerRequestInterface;
use Tobscure\JsonApi\Document;

class ChangeTagSubscription extends AbstractShowController
{
use AssertPermissionTrait;

/**
* {@inheritdoc}
*/
Expand All @@ -33,11 +31,14 @@ class ChangeTagSubscription extends AbstractShowController
*/
protected function data(ServerRequestInterface $request, Document $document)
{
/**
* @var User
*/
$actor = $request->getAttribute('actor');
$id = Arr::get($request->getQueryParams(), 'id');
$subscription = Arr::get($request->getParsedBody(), 'data.subscription');

$this->assertRegistered($actor);
$actor->assertRegistered();

$tag = Tag::whereVisibleTo($actor)->findOrFail($id);
$state = $tag->stateFor($actor);
Expand Down

0 comments on commit 6ddf32b

Please sign in to comment.