mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-08-03 08:21:07 +00:00
add quest invitation email (disabled for now) and fixes
This commit is contained in:
parent
4f66d30441
commit
7d139b4adc
3 changed files with 34 additions and 2 deletions
|
|
@ -675,7 +675,6 @@ questStart = function(req, res, next) {
|
|||
if (m == group.quest.leader)
|
||||
updates['$inc']['items.quests.'+key] = -1;
|
||||
if (group.quest.members[m] == true) {
|
||||
console.log(m);
|
||||
// See https://github.com/HabitRPG/habitrpg/issues/2168#issuecomment-31556322 , we need to *not* reset party.quest.progress.up
|
||||
//updates['$set']['party.quest'] = Group.cleanQuestProgress({key:key,progress:{collect:collected}});
|
||||
updates['$set']['party.quest.key'] = key;
|
||||
|
|
@ -765,12 +764,33 @@ api.questAccept = function(req, res, next) {
|
|||
}
|
||||
});
|
||||
|
||||
User.find({
|
||||
_id: {
|
||||
$in: _.without(group.members, user._id)
|
||||
}
|
||||
}, {auth: 1, preferences: 1, profile: 1}, function(err, members){
|
||||
if(err) return next(err);
|
||||
|
||||
_.each(members, function(member){
|
||||
if(member.preferences.emailNotifications.invitedQuest !== false && false
|
||||
){
|
||||
utils.txnEmail(member, ('invite-' + (quest.boss ? 'boss' : 'collection') + '-quest'), [
|
||||
{name: 'QUEST_NAME', content: quest.text()},
|
||||
{name: 'INVITER', content: utils.getUserInfo(user, ['name']).name},
|
||||
{name: 'PARTY_URL', content: nconf.get('BASE_URL') + '/#/options/groups/party'}
|
||||
]);
|
||||
}
|
||||
});
|
||||
|
||||
questStart(req,res,next);
|
||||
});
|
||||
|
||||
// Party member accepting the invitation
|
||||
} else {
|
||||
if (!group.quest.key) return res.json(400,{err:'No quest invitation has been sent out yet.'});
|
||||
group.quest.members[user._id] = true;
|
||||
questStart(req,res,next);
|
||||
}
|
||||
questStart(req,res,next);
|
||||
}
|
||||
|
||||
api.questReject = function(req, res, next) {
|
||||
|
|
|
|||
|
|
@ -308,6 +308,8 @@ var UserSchema = new Schema({
|
|||
giftedSubscription: {type: Boolean, 'default': true},
|
||||
invitedParty: {type: Boolean, 'default': true},
|
||||
invitedGuild: {type: Boolean, 'default': true},
|
||||
questStarted: {type: Boolean, 'default': true},
|
||||
invitedQuest: {type: Boolean, 'default': true},
|
||||
//remindersToLogin: {type: Boolean, 'default': true},
|
||||
importantAnnouncements: {type: Boolean, 'default': true}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -305,6 +305,16 @@ script(id='partials/options.settings.notifications.html', type="text/ng-template
|
|||
input(type='checkbox', ng-disabled='user.preferences.emailNotifications.unsubscribeFromAll === true', ng-model='user.preferences.emailNotifications.invitedGuild', ng-change='set({"preferences.emailNotifications.invitedGuild": user.preferences.emailNotifications.invitedGuild ? true: false})')
|
||||
span=env.t('invitedGuild')
|
||||
|
||||
.checkbox
|
||||
label
|
||||
input(type='checkbox', ng-disabled='user.preferences.emailNotifications.unsubscribeFromAll === true', ng-model='user.preferences.emailNotifications.questStarted', ng-change='set({"preferences.emailNotifications.questStarted": user.preferences.emailNotifications.questStarted ? true: false})')
|
||||
span=env.t('questStarted')
|
||||
|
||||
.checkbox
|
||||
label
|
||||
input(type='checkbox', ng-disabled='user.preferences.emailNotifications.unsubscribeFromAll === true', ng-model='user.preferences.emailNotifications.invitedQuest', ng-change='set({"preferences.emailNotifications.invitedQuest": user.preferences.emailNotifications.invitedQuest ? true: false})')
|
||||
span=env.t('invitedQuest')
|
||||
|
||||
//.checkbox
|
||||
label
|
||||
input(type='checkbox', ng-disabled='user.preferences.emailNotifications.unsubscribeFromAll === true', ng-model='user.preferences.emailNotifications.remindersToLogin', ng-change='set({"preferences.emailNotifications.remindersToLogin": user.preferences.emailNotifications.remindersToLogin ? true: false})')
|
||||
|
|
|
|||
Loading…
Reference in a new issue