mirror of
https://github.com/flarum/framework.git
synced 2024-11-29 21:11:55 +08:00
Make post filtering work with database prefixes
This commit is contained in:
parent
665f241348
commit
9b03f8c71a
|
@ -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')
|
||||
|
|
Loading…
Reference in New Issue
Block a user