Use RequestUtil to access actor

This commit is contained in:
Alexander Skvortsov 2021-04-08 00:03:18 -04:00
parent 46aabd2ae5
commit cd3934e358

View File

@ -10,6 +10,7 @@
namespace Flarum\Mentions; namespace Flarum\Mentions;
use Flarum\Api\Controller; use Flarum\Api\Controller;
use Flarum\Http\RequestUtil;
use Flarum\Post\CommentPost; use Flarum\Post\CommentPost;
use Flarum\Post\PostRepository; use Flarum\Post\PostRepository;
use Illuminate\Database\Eloquent\Collection; use Illuminate\Database\Eloquent\Collection;
@ -57,7 +58,7 @@ class FilterVisiblePosts
if (isset($posts)) { if (isset($posts)) {
$posts = new Collection($posts); $posts = new Collection($posts);
$actor = $request->getAttribute('actor'); $actor = RequestUtil::getActor($request);
$posts = $posts->filter(function ($post) { $posts = $posts->filter(function ($post) {
return $post instanceof CommentPost; return $post instanceof CommentPost;