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

fix(upgrades): Fetch the correct current subscription for the user #1664

Merged
merged 1 commit into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/app/account-app/account-upgrades.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
{{ plan.name.replace('Runbox', '') }}
</mat-card-title>
<mat-card-subtitle [ngClass]="{'themePaletteDarkGray': over_quota.length > 0}">
<h4><span *ngIf="is_current_subscription"> Your current subscription </span></h4>
<h4><span *ngIf="current_sub && current_sub.pid == plan.pid"> Your current subscription </span></h4>

Check warning on line 101 in src/app/account-app/account-upgrades.component.html

View workflow job for this annotation

GitHub Actions / Run lint tests

Expected `===` but received `==`
</mat-card-subtitle>
<mat-card-content>
<div>
Expand Down Expand Up @@ -142,8 +142,8 @@
<span *ngIf="me.is_trial">Subscribe for</span>
<span *ngIf="!me.is_trial && me.subscription === undefined">Purchase for</span>
<span *ngIf="!me.is_trial && (orig_three_plans[i].pid === me.subscription || plan.pid === me.subscription)">Renew for</span>
<span *ngIf="!me.is_trial && plan.quotas.Disk.quota > current_sub.quotas.Disk.quota">Upgrade to</span>
<span *ngIf="!me.is_trial && plan.quotas.Disk.quota < current_sub.quotas.Disk.quota">Downgrade to</span>
<span *ngIf="!me.is_trial && current_sub && plan.quotas.Disk.quota > current_sub.quotas.Disk.quota">Upgrade to</span>
<span *ngIf="!me.is_trial && current_sub && plan.quotas.Disk.quota < current_sub.quotas.Disk.quota">Downgrade to</span>
{{ plan.currency.replace("USD","$") }}{{ plan.price | number:'1.2-2' }}
</button>
<ng-template #unpurchase>
Expand Down Expand Up @@ -222,7 +222,7 @@
<td class="planComponent priceForOneYear">Price for 1 year</td>
<td *ngFor="let plan of subs_regular" class="oneYear">
<div>
{{ plan.currency.replace("USD","$") }}{{ plan.price }} <span *ngIf="is_current_subscription"> Your current {{ p.type }} </span>
{{ plan.currency.replace("USD","$") }}{{ plan.price }} <span *ngIf="current_sub && current_sub.pid == plan.pid"> Your current {{ plan.type }} </span>

Check warning on line 225 in src/app/account-app/account-upgrades.component.html

View workflow job for this annotation

GitHub Actions / Run lint tests

Expected `===` but received `==`
</div>
<div>
<button mat-raised-button
Expand Down
6 changes: 3 additions & 3 deletions src/app/account-app/account-upgrades.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,9 @@ export class AccountUpgradesComponent implements OnInit {
this.rmmapi.me.subscribe(me => {
this.me = me;
// User's current subscription product:
if (this.subscriptions) {
this.current_sub = products.find(p => p.pid === this.me.subscription);
}
this.rmmapi.getProducts([this.me.subscription]).subscribe(res => {
this.current_sub = res[0];
});
this.limitedTimeOffer = !me.newerThan(this.limited_time_offer_age);
});
});
Expand Down
Loading