mirror of
https://github.com/flarum/framework.git
synced 2025-01-28 00:56:31 +08:00
Removes AssertPermissionTrait (#20)
* Removes AssertPermissionTrait * Fix my dumb mistake
This commit is contained in:
parent
27925133d6
commit
e8490bd991
|
@ -13,13 +13,10 @@ use Flarum\Likes\Event\PostWasLiked;
|
||||||
use Flarum\Likes\Event\PostWasUnliked;
|
use Flarum\Likes\Event\PostWasUnliked;
|
||||||
use Flarum\Post\Event\Deleted;
|
use Flarum\Post\Event\Deleted;
|
||||||
use Flarum\Post\Event\Saving;
|
use Flarum\Post\Event\Saving;
|
||||||
use Flarum\User\AssertPermissionTrait;
|
|
||||||
use Illuminate\Contracts\Events\Dispatcher;
|
use Illuminate\Contracts\Events\Dispatcher;
|
||||||
|
|
||||||
class SaveLikesToDatabase
|
class SaveLikesToDatabase
|
||||||
{
|
{
|
||||||
use AssertPermissionTrait;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Dispatcher $events
|
* @param Dispatcher $events
|
||||||
*/
|
*/
|
||||||
|
@ -41,7 +38,7 @@ class SaveLikesToDatabase
|
||||||
$actor = $event->actor;
|
$actor = $event->actor;
|
||||||
$liked = (bool) $data['attributes']['isLiked'];
|
$liked = (bool) $data['attributes']['isLiked'];
|
||||||
|
|
||||||
$this->assertCan($actor, 'like', $post);
|
$actor->assertCan('like', $post);
|
||||||
|
|
||||||
$currentlyLiked = $post->likes()->where('user_id', $actor->id)->exists();
|
$currentlyLiked = $post->likes()->where('user_id', $actor->id)->exists();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user