From 42b3a09c26aabb665a3a4fd2042e07dfef9d5bab Mon Sep 17 00:00:00 2001 From: Alexander Skvortsov Date: Fri, 2 Oct 2020 19:05:26 -0400 Subject: [PATCH] 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. --- .../core/js/src/common/utils/patchMithril.js | 23 +------------------ 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/framework/core/js/src/common/utils/patchMithril.js b/framework/core/js/src/common/utils/patchMithril.js index 8360e2b95..a1b114167 100644 --- a/framework/core/js/src/common/utils/patchMithril.js +++ b/framework/core/js/src/common/utils/patchMithril.js @@ -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.');