mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 15:17:25 +01:00
fix(promise): make sure every promise is handled
This commit is contained in:
@@ -203,7 +203,8 @@ async function registerLocal (req, res, { isV3 = false }) {
|
|||||||
} else {
|
} else {
|
||||||
sendTxnEmail(savedUser, 'welcome');
|
sendTxnEmail(savedUser, 'welcome');
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
|
.catch(err => logger.error(err));
|
||||||
|
|
||||||
if (!existingUser) {
|
if (!existingUser) {
|
||||||
res.analytics.track('register', {
|
res.analytics.track('register', {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import passport from 'passport';
|
import passport from 'passport';
|
||||||
import common from '../../../common';
|
import common from '../../../common';
|
||||||
import { BadRequest } from '../errors';
|
import { BadRequest } from '../errors';
|
||||||
|
import logger from '../logger';
|
||||||
import {
|
import {
|
||||||
generateUsername,
|
generateUsername,
|
||||||
loginRes,
|
loginRes,
|
||||||
@@ -98,7 +99,8 @@ export async function loginSocial (req, res) { // eslint-disable-line import/pre
|
|||||||
sendTxnEmail(savedUser, 'welcome');
|
sendTxnEmail(savedUser, 'welcome');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}); // eslint-disable-line max-nested-callbacks
|
})
|
||||||
|
.catch(err => logger.error(err)); // eslint-disable-line max-nested-callbacks
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!existingUser) {
|
if (!existingUser) {
|
||||||
|
|||||||
@@ -76,7 +76,8 @@ function sendNotification (user, details = {}) {
|
|||||||
logger.error('APN transmissionError', failure.status, notification, failure.device);
|
logger.error('APN transmissionError', failure.status, notification, failure.device);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
})
|
||||||
|
.catch(err => logger.error(err, 'APN error'));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ import {
|
|||||||
import {
|
import {
|
||||||
schema as SubscriptionPlanSchema,
|
schema as SubscriptionPlanSchema,
|
||||||
} from './subscriptionPlan';
|
} from './subscriptionPlan';
|
||||||
|
import logger from '../libs/logger';
|
||||||
import amazonPayments from '../libs/payments/amazon'; // eslint-disable-line import/no-cycle
|
import amazonPayments from '../libs/payments/amazon'; // eslint-disable-line import/no-cycle
|
||||||
import stripePayments from '../libs/payments/stripe'; // eslint-disable-line import/no-cycle
|
import stripePayments from '../libs/payments/stripe'; // eslint-disable-line import/no-cycle
|
||||||
import { getGroupChat, translateMessage } from '../libs/chat/group-chat'; // eslint-disable-line import/no-cycle
|
import { getGroupChat, translateMessage } from '../libs/chat/group-chat'; // eslint-disable-line import/no-cycle
|
||||||
@@ -607,9 +608,11 @@ schema.methods.sendChat = function sendChat (options = {}) {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
User.update(query, lastSeenUpdateRemoveOld, { multi: true }).exec().then(() => {
|
User
|
||||||
User.update(query, lastSeenUpdateAddNew, { multi: true }).exec();
|
.update(query, lastSeenUpdateRemoveOld, { multi: true })
|
||||||
});
|
.exec()
|
||||||
|
.then(() => User.update(query, lastSeenUpdateAddNew, { multi: true }).exec())
|
||||||
|
.catch(err => logger.error(err));
|
||||||
|
|
||||||
if (this.type === 'party' && user) {
|
if (this.type === 'party' && user) {
|
||||||
sendChatPushNotifications(user, this, newChatMessage, mentions, translate);
|
sendChatPushNotifications(user, this, newChatMessage, mentions, translate);
|
||||||
@@ -810,7 +813,8 @@ schema.methods.sendGroupChatReceivedWebhooks = function sendGroupChatReceivedWeb
|
|||||||
chat,
|
chat,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
})
|
||||||
|
.catch(err => logger.error(err));
|
||||||
};
|
};
|
||||||
|
|
||||||
schema.statics.cleanQuestParty = _cleanQuestParty;
|
schema.statics.cleanQuestParty = _cleanQuestParty;
|
||||||
@@ -944,7 +948,8 @@ schema.methods.finishQuest = async function finishQuest (quest) {
|
|||||||
quest,
|
quest,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
})
|
||||||
|
.catch(err => logger.error(err));
|
||||||
|
|
||||||
_.forEach(questSeriesAchievements, (questList, achievement) => {
|
_.forEach(questSeriesAchievements, (questList, achievement) => {
|
||||||
if (questList.includes(questK)) {
|
if (questList.includes(questK)) {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import mongoose from 'mongoose';
|
import mongoose from 'mongoose';
|
||||||
|
|
||||||
|
import logger from '../../libs/logger';
|
||||||
import schema from './schema'; // eslint-disable-line import/no-cycle
|
import schema from './schema'; // eslint-disable-line import/no-cycle
|
||||||
|
|
||||||
import './hooks'; // eslint-disable-line import/no-cycle
|
import './hooks'; // eslint-disable-line import/no-cycle
|
||||||
@@ -32,4 +33,5 @@ mongoose.model('User')
|
|||||||
.then(foundMods => {
|
.then(foundMods => {
|
||||||
// Using push to maintain the reference to mods
|
// Using push to maintain the reference to mods
|
||||||
mods.push(...foundMods);
|
mods.push(...foundMods);
|
||||||
});
|
})
|
||||||
|
.catch(err => logger.error(err));
|
||||||
|
|||||||
Reference in New Issue
Block a user