mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 06:37:23 +01:00
Upgrade server deps (#10017)
* remove unused apn lib and upgrade moment-recur * upgrade validator * upgrade got * request -> got * fix validation * fix tests * upgrade nodemailer * fix unit tests * fix webhook tests, upgrade express-validator (using legacy api) * upgrade js2xmlparser * update misc packages * fix linting * update packages
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
import _ from 'lodash';
|
||||
import nconf from 'nconf';
|
||||
// TODO remove this lib and use directly the apn module
|
||||
// @TODO remove this lib and use directly the apn module
|
||||
import pushNotify from 'push-notify';
|
||||
import apnLib from 'apn';
|
||||
import logger from './logger';
|
||||
import Bluebird from 'bluebird';
|
||||
import {
|
||||
@@ -44,21 +43,9 @@ if (APN_ENABLED) {
|
||||
apn.on('transmissionError', (errorCode, notification, device) => {
|
||||
logger.error('APN transmissionError', errorCode, notification, device);
|
||||
});
|
||||
|
||||
let feedback = new apnLib.Feedback({
|
||||
key,
|
||||
cert,
|
||||
batchFeedback: true,
|
||||
interval: 3600, // Check for feedback once an hour
|
||||
});
|
||||
|
||||
feedback.on('feedback', (devices) => {
|
||||
if (devices && devices.length > 0) {
|
||||
logger.info('Delivery of push notifications failed for some Apple devices.', devices);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function sendNotification (user, details = {}) {
|
||||
if (!user) throw new Error('User is required.');
|
||||
if (user.preferences.pushNotifications.unsubscribeFromAll === true) return;
|
||||
|
||||
Reference in New Issue
Block a user