-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update dependencies and add Github Actions #26
base: master
Are you sure you want to change the base?
Conversation
@phillipthelen This looks fantastic! Great job adding all those Actions checks. Might there be a way for us to run this through a staging test? Put it up on a freebie Heroku or Hetzner server and point Staging at it for a little while, see if anything crops up? |
I don't have experience setting up our projects on heroku, but it should be possible, yes. Pointing staging to it sounds good. |
libs/googlePayments.js
Outdated
let purchaseDataList = iap.getPurchaseData(response); | ||
let subscription = purchaseDataList[0]; | ||
const purchaseDataList = iap.getPurchaseData(response); | ||
const subscription = purchaseDataList[0]; | ||
if (subscription.expirationDate < jobStartDate) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ha, the logic is the same but the conditions are inverted, vs Apple... what :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic was also inverted. the if case being cancellation here and another check on iOS. I flipped it here, so that both use the same check/logic for consistency
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did a much closer look--probably nitpicky, but while we're in here cleaning house, might be good?
libs/googlePayments.js
Outdated
return habitrpgUsers.find(query, { | ||
sort: {_id: 1}, | ||
sort: { _id: 1 }, | ||
limit: USERS_BATCH, | ||
fields: ['_id', 'apiToken', 'purchased.plan'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the same lookup as on Apple, but it doesn't do the blocked user check--
- Should it?
- Does this suggest we should abstract the find function to a lib?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed the block check from Apple. Thinking about it, we don't really want that. If an account is blocked, we'd still want to (properly) cancel their subscription. Otherwise it will get checked over and over.
Moving more code into a lib to avoid code duplication sounds smart. But I would do that in a separate PR.
libs/groupSubscriptionManager.js
Outdated
@@ -13,17 +13,6 @@ var pageLimit = 10; | |||
|
|||
var SUBSCRIPTION_CANCEL_URL = 'https://habitica.com/amazon/subscribe/cancel'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we get the BASE_URL from the environment and append the rest of the path?
libs/pushNotifications.js
Outdated
var gcmLib = require('node-gcm'); // works with FCM notifications too | ||
var AWS = require('aws-sdk'); | ||
import nconf from 'nconf'; | ||
/*import pushNotify from 'push-notify'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Big commented-out file? If we're not handling this here anymore, can we delete it proper-like?
@@ -18,12 +15,12 @@ api.scheduleNextCheckForUser = function scheduleNextCheckForUser (habitrpgUsers, | |||
$set: { | |||
'purchased.plan.lastReminderDate': moment().toDate(), | |||
}, | |||
} | |||
}, | |||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to .exec()
this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or, wait, we're using monk
rather than mongoose
, is that why?
@@ -84,18 +72,18 @@ api.processUser = function processUser (habitrpgUsers, user, queue, baseUrl, job | |||
'Found user with id', user._id, 'lastReminderDate', user.purchased.plan.lastReminderDate, | |||
'last paymentdate', lastBillingDate.toString(), | |||
'next date', nextBillingDate.toString()); | |||
console.log('Plan', plan);*/ | |||
console.log('Plan', plan); */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Various commented out console logs--do we need these?
@@ -18,14 +15,14 @@ api.scheduleNextCheckForGroup = function scheduleNextCheckForGroup (habitrpgGrou | |||
$set: { | |||
'purchased.plan.lastReminderDate': moment().toDate(), | |||
}, | |||
} | |||
}, | |||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same things in this file as Amazon reminders base--exec? console logs?
server.js
Outdated
}); | ||
queue.on('failed', (job, error) => { | ||
console.log(error); | ||
/* const args = Array.prototype.slice.call(arguments); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More commented out code? I understand on the recap emails, it's a good reminder that such a thing exists and could be enabled again, but what about this?
workers/email.js
Outdated
import fs from 'fs'; | ||
import nconf from 'nconf'; | ||
import mandrill from 'mandrill-api'; | ||
import _ from 'lodash'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like we only use find
and findIndex
here, can we import those individually?
workers/onboardingEmails.js
Outdated
const emailsLib = require('../libs/email'); | ||
const USERS_BATCH = 10; | ||
import moment from 'moment'; | ||
import lodash from 'lodash'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
random, template, and assign--
if nothing else, we should probably be consistent about importing it as _
vs lodash
!
1d745de
to
50fdf95
Compare
this is still WIP. As a test I added a GH action to lint the project.