Node.js based forum software built for the modern web
refactor(remountable-routes): rename `src/routes/accounts.js` to `src/routes/user.js` to better match the route prefix
Julian Lam1f28713f1aac
diff --git a/src/routes/index.js b/src/routes/index.jsindex c94511d146..be1d1f4e05 100644--- a/src/routes/index.js+++ b/src/routes/index.js@@ -17,7 +17,7 @@ const helpers = require('./helpers');const { setupPageRoute } = helpers;const _mounts = {- account: require('./accounts'),+ user: require('./user'),meta: require('./meta'),api: require('./api'),admin: require('./admin'),@@ -81,10 +81,10 @@ _mounts.category = (app, name, middleware, controllers) => {setupPageRoute(app, `/${name}/:category_id/:slug?`, middleware, [], controllers.category.get);};-_mounts.user = (app, middleware, controllers) => {+_mounts.users = (app, name, middleware, controllers) => {const middlewares = [middleware.canViewUsers];- setupPageRoute(app, '/users', middleware, middlewares, controllers.users.index);+ setupPageRoute(app, `/${name}`, middleware, middlewares, controllers.users.index);};_mounts.group = (app, middleware, controllers) => {@@ -131,14 +131,12 @@ async function addCoreRoutes(app, router, middleware) {_mounts.mod(router, middleware, controllers);_mounts.globalMod(router, middleware, controllers);_mounts.tag(router, middleware, controllers);- _mounts.user(router, middleware, controllers);_mounts.group(router, middleware, controllers);// Allow plugins/themes to mount some routes elsewhere- const remountable = ['admin', 'category', 'topic', 'post', 'account'];- const mountHash = { // some mounts are named differently for organizational purposes- account: 'user',- };+ const remountable = ['admin', 'category', 'topic', 'post', 'users', 'user'];+ const mountHash = {}; // if a mount is named differently for organizational purposes, add the change here+await Promise.all(remountable.map(async (mount) => {const method = mount;const original = mountHash[mount] || mount;diff --git a/src/routes/accounts.js b/src/routes/user.jssimilarity index 100%rename from src/routes/accounts.jsrename to src/routes/user.js