Ensure compatibility with DB table prefix

This commit is contained in:
Franz Liedke 2018-08-03 01:21:58 +02:00
parent dfaf1bad09
commit dd1f2d46fd
4 changed files with 6 additions and 6 deletions

View File

@ -82,7 +82,7 @@ class DiscussionPolicy extends AbstractPolicy
return $query->selectRaw('1') return $query->selectRaw('1')
->from('discussions_tags') ->from('discussions_tags')
->whereIn('tag_id', Tag::getIdsWhereCannot($actor, 'viewDiscussions')) ->whereIn('tag_id', Tag::getIdsWhereCannot($actor, 'viewDiscussions'))
->whereRaw('discussions.id = discussion_id'); ->whereColumn('discussions.id', 'discussion_id');
}); });
// Hide discussions with no tags if the user doesn't have that global // Hide discussions with no tags if the user doesn't have that global
@ -106,7 +106,7 @@ class DiscussionPolicy extends AbstractPolicy
return $query->selectRaw('1') return $query->selectRaw('1')
->from('discussions_tags') ->from('discussions_tags')
->whereIn('tag_id', Tag::getIdsWhereCan($actor, 'discussion.'.$ability)) ->whereIn('tag_id', Tag::getIdsWhereCan($actor, 'discussion.'.$ability))
->whereRaw('discussions.id = discussion_id'); ->whereColumn('discussions.id', 'discussion_id');
}); });
} }

View File

@ -38,7 +38,7 @@ class FlagPolicy extends AbstractPolicy
return $query->selectRaw('1') return $query->selectRaw('1')
->from('discussions_tags') ->from('discussions_tags')
->whereIn('tag_id', Tag::getIdsWhereCannot($actor, 'discussion.viewFlags')) ->whereIn('tag_id', Tag::getIdsWhereCannot($actor, 'discussion.viewFlags'))
->whereRaw('discussions.id = discussion_id'); ->whereColumn('discussions.id', 'discussion_id');
}); });
} }
} }

View File

@ -48,7 +48,7 @@ class TagGambit extends AbstractRegexGambit
$query->orWhereExists(function ($query) { $query->orWhereExists(function ($query) {
$query->selectRaw('1') $query->selectRaw('1')
->from('discussions_tags') ->from('discussions_tags')
->whereRaw('discussions.id = discussion_id'); ->whereColumn('discussions.id', 'discussion_id');
}, ! $negate); }, ! $negate);
} else { } else {
$id = $this->tags->getIdForSlug($slug); $id = $this->tags->getIdForSlug($slug);
@ -56,7 +56,7 @@ class TagGambit extends AbstractRegexGambit
$query->orWhereExists(function ($query) use ($id) { $query->orWhereExists(function ($query) use ($id) {
$query->selectRaw('1') $query->selectRaw('1')
->from('discussions_tags') ->from('discussions_tags')
->whereRaw('discussions.id = discussion_id') ->whereColumn('discussions.id', 'discussion_id')
->where('tag_id', $id); ->where('tag_id', $id);
}, $negate); }, $negate);
} }

View File

@ -53,7 +53,7 @@ class FilterDiscussionListByTags
return $query->selectRaw('1') return $query->selectRaw('1')
->from('discussions_tags') ->from('discussions_tags')
->whereIn('tag_id', Tag::where('is_hidden', 1)->pluck('id')) ->whereIn('tag_id', Tag::where('is_hidden', 1)->pluck('id'))
->whereRaw('discussions.id = discussion_id'); ->whereColumn('discussions.id', 'discussion_id');
}); });
} }
} }