2017-11-22 10:34:21 +01:00
|
|
|
import { withPluginApi } from 'discourse/lib/plugin-api';
|
2018-03-14 05:35:38 +01:00
|
|
|
import DiscourseURL from 'discourse/lib/url';
|
2017-11-22 10:34:21 +01:00
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'custom-wizard-edits',
|
2019-12-05 07:48:32 +01:00
|
|
|
initialize(container) {
|
|
|
|
const siteSettings = container.lookup('site-settings:main');
|
|
|
|
|
|
|
|
if (!siteSettings.custom_wizard_enabled) return;
|
2018-03-14 05:35:38 +01:00
|
|
|
|
|
|
|
const existing = DiscourseURL.routeTo;
|
|
|
|
DiscourseURL.routeTo = function(path, opts) {
|
2018-08-29 02:01:52 +02:00
|
|
|
if (path && path.indexOf('/w/') > -1) {
|
2018-03-14 05:35:38 +01:00
|
|
|
return window.location = path;
|
|
|
|
}
|
|
|
|
return existing.apply(this, [path, opts]);
|
|
|
|
};
|
2017-11-22 10:34:21 +01:00
|
|
|
}
|
|
|
|
};
|