28e4eb60ae
refs https://github.com/TryGhost/Team/issues/2233 **Problem** When a user clicks an offer link that has an archived tier, the site blocks and you are no longer able to scroll. This is because the product for that offer can't be found. This has been fixed by updating the `isActiveOffer` helper to also check for the existence of the corresponding tier. **Solution** - You no longer are able to create new offers if there are no active tiers - A custom message is shown that instructs the user to create a new tier if there are not active tiers on the offers page - Improved detection of changes in tiers by correctly reloading the members utils service after tier changes - Portal redirects to the homepage for offers with an archived tier (same behaviour as invalid offers) - Offers of an archived tier are no longer visible in the dashboard
19 lines
422 B
JavaScript
19 lines
422 B
JavaScript
import OfferRoute from '../offer';
|
|
import {inject as service} from '@ember/service';
|
|
|
|
export default class NewOfferRoute extends OfferRoute {
|
|
@service membersUtils;
|
|
|
|
controllerName = 'offer';
|
|
templateName = 'offer';
|
|
|
|
/**
|
|
* First check if we have active tiers
|
|
*/
|
|
beforeModel() {
|
|
if (!this.membersUtils.hasActiveTiers) {
|
|
return this.replaceWith('offers');
|
|
}
|
|
}
|
|
}
|