mirror of
https://github.com/flarum/framework.git
synced 2025-02-28 03:33:27 +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
|
// Make sure the post's discussion is visible as well
|
||||||
$query->whereExists(function ($query) use ($actor) {
|
$query->whereExists(function ($query) use ($actor) {
|
||||||
|
$grammar = $query->getGrammar();
|
||||||
|
$column1 = $grammar->wrap('discussions.id');
|
||||||
|
$column2 = $grammar->wrap('posts.discussion_id');
|
||||||
|
|
||||||
$query->selectRaw('1')
|
$query->selectRaw('1')
|
||||||
->from('discussions')
|
->from('discussions')
|
||||||
->whereRaw('discussions.id = posts.discussion_id');
|
->whereRaw("$column1 = $column2");
|
||||||
|
|
||||||
static::$dispatcher->dispatch(
|
static::$dispatcher->dispatch(
|
||||||
new ScopeModelVisibility(Discussion::query()->setQuery($query), $actor, 'view')
|
new ScopeModelVisibility(Discussion::query()->setQuery($query), $actor, 'view')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user