mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 07:37:25 +01:00
v3: iap accessible under /api/v3, fixes to spells and groups invitations
This commit is contained in:
@@ -513,6 +513,7 @@ async function _inviteByUUID (uuid, group, inviter, req, res) {
|
||||
}
|
||||
|
||||
let groupLabel = group.type === 'guild' ? 'Guild' : 'Party';
|
||||
let groupTemplate = group.type === 'guild' ? 'guild' : 'party';
|
||||
if (userToInvite.preferences.emailNotifications[`invited${groupLabel}`] !== false) {
|
||||
let emailVars = [
|
||||
{name: 'INVITER', content: inviter.profile.name},
|
||||
@@ -530,7 +531,7 @@ async function _inviteByUUID (uuid, group, inviter, req, res) {
|
||||
);
|
||||
}
|
||||
|
||||
sendTxnEmail(userToInvite, `invited-${groupLabel}`, emailVars);
|
||||
sendTxnEmail(userToInvite, `invited-${groupTemplate}`, emailVars);
|
||||
}
|
||||
|
||||
sendPushNotification(
|
||||
|
||||
4
website/server/controllers/api-v3/iap.js
Normal file
4
website/server/controllers/api-v3/iap.js
Normal file
@@ -0,0 +1,4 @@
|
||||
// NOTE: this file is only used because the mobile apps expect IAP routes
|
||||
// to be found at /api/v3/iap instead of /iap.
|
||||
|
||||
module.exports = require('../top-level/payments/iap');
|
||||
@@ -378,7 +378,10 @@ api.castSpell = {
|
||||
|
||||
spell.cast(user, tasks, req);
|
||||
|
||||
let toSave = tasks.filter(t => t.isModified());
|
||||
let toSave = tasks
|
||||
.filter(t => t.isModified())
|
||||
.map(t => t.save());
|
||||
|
||||
toSave.unshift(user.save());
|
||||
let saved = await Bluebird.all(toSave);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user