Skip to content

Commit

Permalink
disable push notifications and fix buying gems
Browse files Browse the repository at this point in the history
  • Loading branch information
paglias committed May 24, 2016
1 parent 048d55b commit 1e270e4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
6 changes: 3 additions & 3 deletions website/server/libs/api-v3/payments.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
} from './email';
import moment from 'moment';
import nconf from 'nconf';
import pushNotify from './pushNotifications';
import sendPushNotification from './pushNotifications';
import shared from '../../../../common' ;

const IS_PROD = nconf.get('IS_PROD');
Expand Down Expand Up @@ -102,7 +102,7 @@ api.createSubscription = async function createSubscription (data) {
}

if (data.gift.member._id !== data.user._id) { // Only send push notifications if sending to a user other than yourself
pushNotify.sendNotify(data.gift.member, shared.i18n.t('giftedSubscription'), `${months} months - by ${byUserName}`);
sendPushNotification(data.gift.member, shared.i18n.t('giftedSubscription'), `${months} months - by ${byUserName}`);
}
}

Expand Down Expand Up @@ -172,7 +172,7 @@ api.buyGems = async function buyGems (data) {
}

if (data.gift.member._id !== data.user._id) { // Only send push notifications if sending to a user other than yourself
pushNotify.sendNotify(data.gift.member, shared.i18n.t('giftedGems'), `${gemAmount} Gems - by ${byUsername}`);
sendPushNotification(data.gift.member, shared.i18n.t('giftedGems'), `${gemAmount} Gems - by ${byUsername}`);
}

await data.gift.member.save();
Expand Down
7 changes: 6 additions & 1 deletion website/server/libs/api-v3/pushNotifications.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable */

import _ from 'lodash';
import nconf from 'nconf';
import pushNotify from 'push-notify';
Expand Down Expand Up @@ -26,9 +28,12 @@ if (gcm) {
}

module.exports = function sendNotification (user, title, message, timeToLive = 15) {
return; // TODO push notifications are not currently enabled

if (!user) return;
let pushDevices = user.pushDevices.toObject ? user.pushDevices.toObject() : user.pushDevices;

_.each(user.pushDevices, pushDevice => {
_.each(pushDevices, pushDevice => {
switch (pushDevice.type) {
case 'android':
if (gcm) {
Expand Down

0 comments on commit 1e270e4

Please sign in to comment.