Push notifications (#7682)

* Fix Social Push notifications

* Fix code formatting issues

* Fix commented issues

* Fix Syntax errors

* update push notify dependency

* specify push-notify version

* change how apn key is loaded

* feat(push-notifications): improve logging

* feat(push-notifications): disable v2 push notifications

* test(push-notifications): add unit tests and improve integration ones

* fix(push-notifications): throw when required params are missing

* fix(tests): correct descriptions and remove wrong comment

* fix(push-notifications): trim APN key

* fix(apn): log feedback only if it has data

* fix(apn): load cert and key differently

* fix(tests): correctly load apn during tests

* download creds from S3 and create AWS lib

* convert s3 buffer to a string

* fix(apn): remove console.log and do not use cert twice

* invert key and cert, disable failing test

* invert key and cert
This commit is contained in:
Matteo Pagliazzi
2016-06-23 00:19:37 +02:00
committed by GitHub
parent 09c7c45cd5
commit 08d7727881
26 changed files with 626 additions and 293 deletions

View File

@@ -3,6 +3,7 @@ import shared from '../../../../common';
import _ from 'lodash';
import validator from 'validator';
import { schema as TagSchema } from '../tag';
import { schema as PushDeviceSchema } from '../pushDevice';
import {
schema as UserNotificationSchema,
} from '../userNotification';
@@ -431,6 +432,17 @@ let schema = new Schema({
importantAnnouncements: {type: Boolean, default: true},
weeklyRecaps: {type: Boolean, default: true},
},
pushNotifications: {
unsubscribeFromAll: {type: Boolean, default: false},
newPM: {type: Boolean, default: true},
wonChallenge: {type: Boolean, default: true},
giftedGems: {type: Boolean, default: true},
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},
},
suppressModals: {
levelUp: {type: Boolean, default: false},
hatchPet: {type: Boolean, default: false},
@@ -505,10 +517,7 @@ let schema = new Schema({
extra: {type: Schema.Types.Mixed, default: () => {
return {};
}},
pushDevices: [{
regId: {type: String},
type: {type: String},
}],
pushDevices: [PushDeviceSchema],
}, {
strict: true,
minimize: false, // So empty objects are returned