mirror of
https://github.com/flarum/framework.git
synced 2024-12-04 00:03:37 +08:00
Specify ambiguous column names
This commit is contained in:
parent
9ca95afafe
commit
97a94a8c60
|
@ -92,7 +92,7 @@ class DiscussionPolicy extends AbstractPolicy
|
|||
if (! $actor->hasPermission('discussion.hide')) {
|
||||
$query->where(function ($query) use ($actor) {
|
||||
$query->whereNull('discussions.hidden_at')
|
||||
->orWhere('user_id', $actor->id)
|
||||
->orWhere('discussions.user_id', $actor->id)
|
||||
->orWhere(function ($query) use ($actor) {
|
||||
$this->events->fire(
|
||||
new ScopeModelVisibility($query, $actor, 'hide')
|
||||
|
@ -105,8 +105,8 @@ class DiscussionPolicy extends AbstractPolicy
|
|||
// current user, or the user is allowed to edit the discussion's posts.
|
||||
if (! $actor->hasPermission('discussion.editPosts')) {
|
||||
$query->where(function ($query) use ($actor) {
|
||||
$query->where('comment_count', '>', 0)
|
||||
->orWhere('user_id', $actor->id)
|
||||
$query->where('discussions.comment_count', '>', 0)
|
||||
->orWhere('discussions.user_id', $actor->id)
|
||||
->orWhere(function ($query) use ($actor) {
|
||||
$this->events->dispatch(
|
||||
new ScopeModelVisibility($query, $actor, 'editPosts')
|
||||
|
|
|
@ -82,7 +82,7 @@ class PostPolicy extends AbstractPolicy
|
|||
if (! $actor->hasPermission('discussion.editPosts')) {
|
||||
$query->where(function ($query) use ($actor) {
|
||||
$query->whereNull('posts.hidden_at')
|
||||
->orWhere('user_id', $actor->id)
|
||||
->orWhere('posts.user_id', $actor->id)
|
||||
->orWhereExists(function ($query) use ($actor) {
|
||||
$query->selectRaw('1')
|
||||
->from('discussions')
|
||||
|
|
Loading…
Reference in New Issue
Block a user