Skip to content

Node.js based forum software built for the modern web

update core to allow composer to define static route

Julian Lamd67efa3a5b98
diff --git a/package.json b/package.json
index e20b8a5460..6616a20372 100644
--- a/package.json
+++ b/package.json
@@ -43,7 +43,7 @@
"mongodb": "~2.1.3",
"morgan": "^1.3.2",
"nconf": "~0.8.2",
- "nodebb-plugin-composer-default": "1.0.26",
+ "nodebb-plugin-composer-default": "2.0.0",
"nodebb-plugin-dbsearch": "0.3.1",
"nodebb-plugin-emoji-extended": "0.4.17",
"nodebb-plugin-markdown": "4.0.10",
diff --git a/public/src/client/compose.js b/public/src/client/compose.js
new file mode 100644
index 0000000000..c50ffe9945
--- /dev/null
+++ b/public/src/client/compose.js
@@ -0,0 +1,19 @@
+'use strict';
+
+/* globals define */
+
+define('forum/compose', [], function() {
+ var Compose = {};
+
+ Compose.init = function() {
+ var container = $('.composer');
+
+ if (container.length) {
+ $(window).trigger('action:composer.enhance', {
+ container: container
+ });
+ }
+ }
+
+ return Compose;
+});
diff --git a/src/controllers/index.js b/src/controllers/index.js
index feb1759820..f3f11fc129 100644
--- a/src/controllers/index.js
+++ b/src/controllers/index.js
@@ -156,14 +156,22 @@ Controllers.register = function(req, res, next) {
};
Controllers.compose = function(req, res, next) {
- if (req.query.p && !res.locals.isAPI) {
- if (req.query.p.startsWith(nconf.get('relative_path'))) {
- req.query.p = req.query.p.replace(nconf.get('relative_path'), '');
+ plugins.fireHook('filter:composer.build', {
+ req: req,
+ res: res,
+ next: next,
+ templateData: {}
+ }, function(err, data) {
+ if (err) {
+ return next(err);
}
- return helpers.redirect(res, req.query.p);
- }
- res.render('', {});
+ if (data.templateData.disabled) {
+ res.render('', {});
+ } else {
+ res.render('compose', data.templateData);
+ }
+ });
};
Controllers.confirmEmail = function(req, res, next) {