Eliminate temporary BC layers from rewrite

During the frontend rewrite, we introduced mithril patches for a `route` attr, and for `m.stream`. Later, we decided not to go that route, but not to remove the patches yet to avoid breaking extensions while we were finalizing the replacements. We can now remove these.

Other BC layers are for things from before beta 14, so those remain in place.
This commit is contained in:
Alexander Skvortsov 2020-10-02 19:05:26 -04:00
parent 530ab7c715
commit 42b3a09c26

View File

@ -1,12 +1,9 @@
import Link from '../components/Link';
import withAttr from './withAttr';
import Stream from './Stream';
let deprecatedMPropWarned = false;
let deprecatedMWithAttrWarned = false;
let deprecatedRouteWarned = false;
export default function patchMithril(global) {
const defaultMithril = global.m;
@ -20,31 +17,13 @@ export default function patchMithril(global) {
modifiedMithril.bidi(node, node.attrs.bidi);
}
// DEPRECATED, REMOVE BETA 15
// Allows us to use a "route" attr on links, which will automatically convert the link to one which
// supports linking to other pages in the SPA without refreshing the document.
if (node.attrs.route) {
if (!deprecatedRouteWarned) {
deprecatedRouteWarned = true;
console.warn('The route attr patch for links is deprecated, please use the Link component (flarum/components/Link) instead.');
}
node.attrs.href = node.attrs.route;
node.tag = Link;
delete node.attrs.route;
}
// END DEPRECATED
return node;
};
Object.keys(defaultMithril).forEach((key) => (modifiedMithril[key] = defaultMithril[key]));
// BEGIN DEPRECATED MITHRIL 2 BC LAYER
modifiedMithril.prop = modifiedMithril.stream = function (...args) {
modifiedMithril.prop = function (...args) {
if (!deprecatedMPropWarned) {
deprecatedMPropWarned = true;
console.warn('m.prop() is deprecated, please use the Stream util (flarum/utils/Streams) instead.');