From 5c51a91e85696035d9203b985bd662f417637580 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?=
 <baris@nodebb.org>
Date: Fri, 26 May 2017 18:34:45 -0400
Subject: [PATCH] fix reward claimable check

---
 src/rewards/index.js  | 3 +--
 src/topics/popular.js | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/rewards/index.js b/src/rewards/index.js
index 2d201e33f3..0fc1b0edf3 100644
--- a/src/rewards/index.js
+++ b/src/rewards/index.js
@@ -74,8 +74,7 @@ function filterCompletedRewards(uid, rewards, callback) {
 				}
 
 				var claimable = parseInt(reward.claimable, 10);
-
-				return claimable === 0 || (userRewards[reward.id] < reward.claimable);
+				return claimable === 0 || (!userRewards[reward.id] || userRewards[reward.id] < reward.claimable);
 			});
 
 			next(null, rewards);
diff --git a/src/topics/popular.js b/src/topics/popular.js
index ee77ef7544..b85e66d213 100644
--- a/src/topics/popular.js
+++ b/src/topics/popular.js
@@ -15,7 +15,7 @@ module.exports = function (Topics) {
 				},
 				function (topics, next) {
 					sortTiedTopicsByViews(topics, next);
-				}
+				},
 			], callback);
 			return;
 		}