mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
Add more achievements to notifications list (#11332)
* Add more achievements to notifications list * use addNotification * Fix logic to not award stable achievements over and over * Improve achievement display * Fix setting notifications for party inviter * Add tests that notifications are added correctly * Fix tests
This commit is contained in:
committed by
Matteo Pagliazzi
parent
ec7ded042b
commit
360aaa9f0b
@@ -606,13 +606,25 @@ api.joinGroup = {
|
||||
promises.push(User.update({
|
||||
$or: [{'party._id': group._id}, {_id: user._id}],
|
||||
'achievements.partyUp': {$ne: true},
|
||||
}, {$set: {'achievements.partyUp': true}}, {multi: true}).exec());
|
||||
}, {$set: {'achievements.partyUp': true}, $push: {notifications: {type: 'ACHIEVEMENT_PARTY_UP'}}}, {multi: true}).exec());
|
||||
if (inviter) {
|
||||
if (inviter.achievements.partyUp !== true) {
|
||||
// Since the notification list of the inviter is already updated in this save we need to add the notification here
|
||||
inviter.addNotification('ACHIEVEMENT_PARTY_UP');
|
||||
}
|
||||
}
|
||||
}
|
||||
if (group.memberCount > 3) {
|
||||
promises.push(User.update({
|
||||
$or: [{'party._id': group._id}, {_id: user._id}],
|
||||
'achievements.partyOn': {$ne: true},
|
||||
}, {$set: {'achievements.partyOn': true}}, {multi: true}).exec());
|
||||
}, {$set: {'achievements.partyOn': true}, $push: {notifications: {type: 'ACHIEVEMENT_PARTY_ON'}}}, {multi: true}).exec());
|
||||
if (inviter) {
|
||||
if (inviter.achievements.partyOn !== true) {
|
||||
// Since the notification list of the inviter is already updated in this save we need to add the notification here
|
||||
inviter.addNotification('ACHIEVEMENT_PARTY_ON');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user