Skip to content

Commit

Permalink
Merge pull request #1664 from shadow-dot-cat/castaway/1663_accounr_plans
Browse files Browse the repository at this point in the history
fix(upgrades): Fetch the correct current subscription for the user
  • Loading branch information
castaway authored Feb 13, 2025
2 parents 249b7c9 + 4012fd6 commit 8d4a12e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
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 @@ <h1 style="margin: 10px 0 20px 0">One extra year for free!</h1>
{{ 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 @@ <h4 *ngFor="let us of addon_usages">
<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 @@ <h4 *ngFor="let us of addon_usages">
<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

0 comments on commit 8d4a12e

Please sign in to comment.