mirror of
https://github.com/flarum/core.git
synced 2025-07-22 01:01:28 +02:00
Only include visible posts in post linkage
This commit is contained in:
@@ -47,9 +47,10 @@ class ShowAction extends BaseAction
|
|||||||
{
|
{
|
||||||
$include = $params->included(['startPost', 'lastPost', 'posts']);
|
$include = $params->included(['startPost', 'lastPost', 'posts']);
|
||||||
|
|
||||||
$discussion = $this->discussions->findOrFail($params->get('id'), $this->actor->getUser());
|
$user = $this->actor->getUser();
|
||||||
|
|
||||||
$discussion->posts_ids = $discussion->posts()->get(['id'])->fetch('id')->all();
|
$discussion = $this->discussions->findOrFail($params->get('id'), $user);
|
||||||
|
$discussion->posts_ids = $discussion->posts()->whereCan($user, 'view')->get(['id'])->fetch('id')->all();
|
||||||
|
|
||||||
if (in_array('posts', $include)) {
|
if (in_array('posts', $include)) {
|
||||||
$relations = ['user', 'user.groups', 'editUser', 'hideUser'];
|
$relations = ['user', 'user.groups', 'editUser', 'hideUser'];
|
||||||
|
Reference in New Issue
Block a user