Make post filtering work with database prefixes

This commit is contained in:
Franz Liedke 2018-07-16 01:22:13 +02:00
parent 665f241348
commit 9b03f8c71a
No known key found for this signature in database
GPG Key ID: 9A0231A879B055F4

View File

@ -122,9 +122,13 @@ class Post extends AbstractModel
// Make sure the post's discussion is visible as well
$query->whereExists(function ($query) use ($actor) {
$grammar = $query->getGrammar();
$column1 = $grammar->wrap('discussions.id');
$column2 = $grammar->wrap('posts.discussion_id');
$query->selectRaw('1')
->from('discussions')
->whereRaw('discussions.id = posts.discussion_id');
->whereRaw("$column1 = $column2");
static::$dispatcher->dispatch(
new ScopeModelVisibility(Discussion::query()->setQuery($query), $actor, 'view')