From 733f619986bcd198b1c9a35c2d7cc6729f464099 Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Thu, 24 Sep 2015 08:28:57 +0930 Subject: [PATCH] Fix is:unread gambit closes #485 --- .../core/src/Core/Discussions/DiscussionRepository.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/framework/core/src/Core/Discussions/DiscussionRepository.php b/framework/core/src/Core/Discussions/DiscussionRepository.php index dec93c24a..9e0a2c335 100644 --- a/framework/core/src/Core/Discussions/DiscussionRepository.php +++ b/framework/core/src/Core/Discussions/DiscussionRepository.php @@ -12,6 +12,7 @@ namespace Flarum\Core\Discussions; use Illuminate\Database\Eloquent\Builder; use Flarum\Core\Users\User; +use Illuminate\Database\Query\Expression; class DiscussionRepository { @@ -50,8 +51,9 @@ class DiscussionRepository { return Discussion::leftJoin('users_discussions', 'users_discussions.discussion_id', '=', 'discussions.id') ->where('user_id', $user->id) - ->where('read_number', '<', 'last_post_number') - ->lists('id'); + ->where('read_number', '>=', new Expression('last_post_number')) + ->lists('id') + ->all(); } /**