Skip to content
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

GH-2158: Subscription_type ping parameter not sending on login #606

Merged
merged 4 commits into from Sep 28, 2020
Merged
Changes from 1 commit
Commits
File filter
Filter file types
Jump to
Jump to file
Failed to load files.

Always

Just for now

Next

Move sign_in_success ping to Account#getUserSubscriptionData to fix r…

…ace condition
  • Loading branch information
benstrumeyer committed Sep 18, 2020
commit 5592a18b8be32d7de82dff5fc52debf280eb6345
@@ -822,9 +822,6 @@ function onMessageHandler(request, sender, callback) {
const { email, password } = message;
account.login(email, password)
.then((response) => {
if (!response.hasOwnProperty('errors')) {
metrics.ping('sign_in_success');
}
callback(response);
})
.catch((err) => {
@@ -22,6 +22,7 @@ import conf from './Conf';
import dispatcher from './Dispatcher';
import { log } from '../utils/common';
import Api from '../utils/api';
import metrics from '../classes/Metrics';

const api = new Api();
const {
@@ -85,7 +86,7 @@ class Account {
}
this._getUserIDFromCookie().then((userID) => {
this._setAccountInfo(userID);
this.getUserSubscriptionData();
this.getUserSubscriptionData({ calledFrom: 'login' });
});
return {};
});
@@ -162,7 +163,7 @@ class Account {
/**
* @return {array} All subscriptions the user has, empty if none
*/
getUserSubscriptionData = () => (
getUserSubscriptionData = (options) => (
this._getUserID()
.then(userID => api.get('stripe/customers', userID, 'cards,subscriptions'))
.then((res) => {
@@ -189,6 +190,9 @@ class Account {
this._setSubscriptionData(plusSubscription);
}
}
if (options && options.calledFrom === 'login') {
metrics.ping('sign_in_success');
}

return subscriptions;
})
ProTip! Use n and p to navigate between commits in a pull request.