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

[server] private repo access after cancellation #4811

Merged
merged 1 commit into from
Jul 14, 2021

Conversation

svenefftinge
Copy link
Member

@svenefftinge svenefftinge commented Jul 14, 2021

If a user cancels their subscription, they should still be able to use it until it ends.

@svenefftinge svenefftinge requested review from a team, jankeromnes and geropl and removed request for a team and jankeromnes July 14, 2021 11:25
@@ -101,7 +101,7 @@ export class SubscriptionService {
async hasActiveAndNotYetCancelledPaidSubscription(userId: string, date: Date): Promise<boolean> {
const subscriptions = await this.accountingDB.findActiveSubscriptionsForUser(userId, date.toISOString());
return subscriptions
.filter(s => Subscription.isActive(s, date.toISOString()) && !Subscription.isCancelled(s))
.filter(s => Subscription.isActive(s, date.toISOString()))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method does what it says on the tin (name), and is used in the other places correctly I think.

But this call is odd indeed: I agree that we should call hasActivePaidSubscription with the implementation you suggested.

Copy link
Member

@geropl geropl Jul 14, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jankeromnes I faintly recall we added made the change here together, right? Do you recall what the motivation was for checking isActive && !isCancelled instead of isActive? IMO this was because of a user that:

  1. bought a subscription
  2. quickly cancelled it (and we reimbursed them)
  3. expected to be back in trial mode immediately (which we promised him when offered the "cancel-and-reimburse")

In general the user-frriendly pattern of "easy-in-easy-out" makes sense here.

@svenefftinge svenefftinge force-pushed the private-repos-after-cancellation branch from d8920a8 to e4ed389 Compare July 14, 2021 13:10
@@ -285,24 +285,6 @@ export class EligibilityService {
return new Date(freeTrialStartDate);
}

/**
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't find a user, so good to remove.

@@ -252,7 +252,7 @@ export class EligibilityService {
return true;
}

return this.subscriptionService.hasActiveAndNotYetCancelledPaidSubscription(user.id, date);
return this.subscriptionService.hasActivePaidSubscription(user.id, date);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@@ -314,7 +296,7 @@ export class EligibilityService {
if (start === undefined) {
return undefined;
}
if (await this.subscriptionService.hasActiveAndNotYetCancelledPaidSubscription(user.id, date)) {
if (await this.subscriptionService.hasActivePaidSubscription(user.id, date)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an edge case, I'm sure we can handle the impact. We dearly need (more) tests including reasoning for this kind of policy changes. 🙈

Copy link
Member

@geropl geropl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did not test but LGTM

@svenefftinge svenefftinge merged commit 4f99741 into main Jul 14, 2021
@svenefftinge svenefftinge deleted the private-repos-after-cancellation branch July 14, 2021 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants