mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-01 13:54:35 +03:00
3b7cbaef05
refs https://github.com/TryGhost/Team/issues/599 - Previously user received genetic limit error after putting in integration name and clicking "create" button. This created a little frustrating experience. - The updated flow does the check before loading the integration modal, so the user receives communication about needed upgrade before doing any work
32 lines
947 B
JavaScript
32 lines
947 B
JavaScript
import RSVP from 'rsvp';
|
|
import Route from '@ember/routing/route';
|
|
import {inject as service} from '@ember/service';
|
|
|
|
export default Route.extend({
|
|
limit: service(),
|
|
|
|
model() {
|
|
if (this.limit.limiter
|
|
&& this.limit.limiter.isLimited('customIntegrations')) {
|
|
return RSVP.hash({
|
|
integration: this.store.createRecord('integration'),
|
|
hostLimitError: this.limit.limiter.errorIfWouldGoOverLimit('customIntegrations')
|
|
.then(() => null)
|
|
.catch((error) => {
|
|
return error;
|
|
})
|
|
});
|
|
} else {
|
|
return RSVP.hash({
|
|
integration: this.store.createRecord('integration'),
|
|
hostLimitError: null
|
|
});
|
|
}
|
|
},
|
|
|
|
deactivate() {
|
|
this._super(...arguments);
|
|
this.controller.integration.rollbackAttributes();
|
|
}
|
|
});
|