Merge pull request #19 from flarum/ds/flags-api-logged-in-check

Assert registered in /api/flags to fix issue with guests
This commit is contained in:
Daniël Klabbers 2019-11-06 13:32:50 +01:00 committed by GitHub
commit f46719c639

View File

@ -14,11 +14,14 @@ namespace Flarum\Flags\Api\Controller;
use Flarum\Api\Controller\AbstractListController;
use Flarum\Flags\Api\Serializer\FlagSerializer;
use Flarum\Flags\Flag;
use Flarum\User\AssertPermissionTrait;
use Psr\Http\Message\ServerRequestInterface;
use Tobscure\JsonApi\Document;
class ListFlagsController extends AbstractListController
{
use AssertPermissionTrait;
/**
* {@inheritdoc}
*/
@ -41,6 +44,8 @@ class ListFlagsController extends AbstractListController
{
$actor = $request->getAttribute('actor');
$this->assertRegistered($actor);
$actor->read_flags_at = time();
$actor->save();