mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
Added remove when previous login incentive notifications exist
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user