Added remove when previous login incentive notifications exist

This commit is contained in:
Keith Holliday
2016-11-28 21:19:53 -06:00
parent a48b8f0e34
commit f4cf906127
2 changed files with 21 additions and 1 deletions

View File

@@ -130,6 +130,14 @@ function trackCronAnalytics (analytics, user, _progress, options) {
function awardLoginIncentives (user) {
if (user.loginIncentives > 50) return;
//Remove old noitification if it exists
user.notifications
.toObject()
.find((notif, index) => {
if (notif.type === 'LOGIN_INCENTIVE') user.notifications.splice(index, 1);
});
let notificationData = {};
notificationData.message = i18n.t('checkinEarned', user.preferences.language);