From dd1f2d46fd57f7f1550883b148f416993446f7ab Mon Sep 17 00:00:00 2001 From: Franz Liedke Date: Fri, 3 Aug 2018 01:21:58 +0200 Subject: [PATCH] Ensure compatibility with DB table prefix --- extensions/tags/src/Access/DiscussionPolicy.php | 4 ++-- extensions/tags/src/Access/FlagPolicy.php | 2 +- extensions/tags/src/Gambit/TagGambit.php | 4 ++-- extensions/tags/src/Listener/FilterDiscussionListByTags.php | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/extensions/tags/src/Access/DiscussionPolicy.php b/extensions/tags/src/Access/DiscussionPolicy.php index 53f7464c2..92208579d 100755 --- a/extensions/tags/src/Access/DiscussionPolicy.php +++ b/extensions/tags/src/Access/DiscussionPolicy.php @@ -82,7 +82,7 @@ class DiscussionPolicy extends AbstractPolicy return $query->selectRaw('1') ->from('discussions_tags') ->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 @@ -106,7 +106,7 @@ class DiscussionPolicy extends AbstractPolicy return $query->selectRaw('1') ->from('discussions_tags') ->whereIn('tag_id', Tag::getIdsWhereCan($actor, 'discussion.'.$ability)) - ->whereRaw('discussions.id = discussion_id'); + ->whereColumn('discussions.id', 'discussion_id'); }); } diff --git a/extensions/tags/src/Access/FlagPolicy.php b/extensions/tags/src/Access/FlagPolicy.php index f5363f6a6..2c363b42e 100755 --- a/extensions/tags/src/Access/FlagPolicy.php +++ b/extensions/tags/src/Access/FlagPolicy.php @@ -38,7 +38,7 @@ class FlagPolicy extends AbstractPolicy return $query->selectRaw('1') ->from('discussions_tags') ->whereIn('tag_id', Tag::getIdsWhereCannot($actor, 'discussion.viewFlags')) - ->whereRaw('discussions.id = discussion_id'); + ->whereColumn('discussions.id', 'discussion_id'); }); } } diff --git a/extensions/tags/src/Gambit/TagGambit.php b/extensions/tags/src/Gambit/TagGambit.php index f4a4b0845..a5a5d2f67 100644 --- a/extensions/tags/src/Gambit/TagGambit.php +++ b/extensions/tags/src/Gambit/TagGambit.php @@ -48,7 +48,7 @@ class TagGambit extends AbstractRegexGambit $query->orWhereExists(function ($query) { $query->selectRaw('1') ->from('discussions_tags') - ->whereRaw('discussions.id = discussion_id'); + ->whereColumn('discussions.id', 'discussion_id'); }, ! $negate); } else { $id = $this->tags->getIdForSlug($slug); @@ -56,7 +56,7 @@ class TagGambit extends AbstractRegexGambit $query->orWhereExists(function ($query) use ($id) { $query->selectRaw('1') ->from('discussions_tags') - ->whereRaw('discussions.id = discussion_id') + ->whereColumn('discussions.id', 'discussion_id') ->where('tag_id', $id); }, $negate); } diff --git a/extensions/tags/src/Listener/FilterDiscussionListByTags.php b/extensions/tags/src/Listener/FilterDiscussionListByTags.php index 59a081c43..4d37cef2c 100755 --- a/extensions/tags/src/Listener/FilterDiscussionListByTags.php +++ b/extensions/tags/src/Listener/FilterDiscussionListByTags.php @@ -53,7 +53,7 @@ class FilterDiscussionListByTags return $query->selectRaw('1') ->from('discussions_tags') ->whereIn('tag_id', Tag::where('is_hidden', 1)->pluck('id')) - ->whereRaw('discussions.id = discussion_id'); + ->whereColumn('discussions.id', 'discussion_id'); }); } }