Redirect to root from '/donate' if the plugin is disabled
This commit is contained in:
parent
4e9cc7d187
commit
d686ece85b
|
@ -1,8 +1,16 @@
|
|||
import DiscourseRoute from "discourse/routes/discourse";
|
||||
import DiscourseURL from 'discourse/lib/url';
|
||||
import { popupAjaxError } from 'discourse/lib/ajax-error';
|
||||
import { ajax } from 'discourse/lib/ajax';
|
||||
|
||||
export default DiscourseRoute.extend({
|
||||
redirect() {
|
||||
if (!Discourse.SiteSettings.discourse_donations_enabled) {
|
||||
DiscourseURL.routeTo('/');
|
||||
return;
|
||||
}
|
||||
},
|
||||
|
||||
setupController(controller) {
|
||||
let charges = [];
|
||||
let subscriptions = [];
|
||||
|
@ -24,6 +32,6 @@ export default DiscourseRoute.extend({
|
|||
});
|
||||
}).catch(popupAjaxError).finally(() => {
|
||||
controller.set('loadingDonations', false);
|
||||
})
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue