nodebb-plugin-composer-default 10.0.12 → 10.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/library.js CHANGED
@@ -179,7 +179,7 @@ plugin.filterComposerBuild = async function (hookData) {
179
179
  }
180
180
  globalPrivileges['topics:tag'] = canTagTopics;
181
181
  const cid = parseInt(req.query.cid, 10);
182
- const topicTitle = topicData && topicData.title ? topicData.title.replace(/%/g, '%').replace(/,/g, ',') : '';
182
+ const topicTitle = topicData && topicData.title ? topicData.title.replace(/%/g, '%').replace(/,/g, ',') : (req.query.title || '');
183
183
  return {
184
184
  req: req,
185
185
  res: res,
@@ -197,7 +197,7 @@ plugin.filterComposerBuild = async function (hookData) {
197
197
 
198
198
  // can't use title property as that is used for page title
199
199
  topicTitle: topicTitle,
200
- titleLength: topicTitle.length,
200
+ titleLength: topicTitle ? topicTitle.length : 0,
201
201
  topic: topicData,
202
202
  thumb: topicData ? topicData.thumb : '',
203
203
  body: body,
@@ -245,8 +245,8 @@ async function generateBody(req, postData) {
245
245
  const translated = await translator.translate(`[[modules:composer.user_said, ${username}]]`);
246
246
  return `${translated}\n` +
247
247
  `> ${postData ? `${postData.content.replace(/\n/g, '\n> ')}\n\n` : ''}`;
248
- } else if (req.query.body) {
249
- return req.query.body;
248
+ } else if (req.query.body || req.query.content) {
249
+ return validator.escape(String(req.query.body || req.query.content));
250
250
  }
251
251
  return postData ? postData.content : '';
252
252
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-composer-default",
3
- "version": "10.0.12",
3
+ "version": "10.0.14",
4
4
  "description": "Default composer for NodeBB",
5
5
  "main": "library.js",
6
6
  "repository": {
@@ -1,17 +1,17 @@
1
- <form role="form" class="composer-default-settings">
2
- <div class="row">
3
- <div class="col-sm-2 col-xs-12 settings-header">General</div>
4
- <div class="col-sm-10 col-xs-12">
5
- <div class="checkbox">
6
- <label class="mdl-switch mdl-js-switch mdl-js-ripple-effect">
7
- <input class="mdl-switch__input" type="checkbox" name="composeRouteEnabled" />
8
- <span class="mdl-switch__label"><strong>Use a separate route for the composer</strong></span>
9
- </label>
10
- </div>
11
- </div>
12
- </div>
13
- </form>
14
-
15
- <button id="save" class="floating-button mdl-button mdl-js-button mdl-button--fab mdl-js-ripple-effect mdl-button--colored">
16
- <i class="material-icons">save</i>
1
+ <form role="form" class="composer-default-settings">
2
+ <div class="row">
3
+ <div class="col-sm-2 col-12 settings-header">General</div>
4
+ <div class="col-sm-10 col-12">
5
+ <div class="checkbox">
6
+ <label class="mdl-switch mdl-js-switch mdl-js-ripple-effect">
7
+ <input class="mdl-switch__input" type="checkbox" name="composeRouteEnabled" />
8
+ <span class="mdl-switch__label"><strong>Use a separate route for the composer</strong></span>
9
+ </label>
10
+ </div>
11
+ </div>
12
+ </div>
13
+ </form>
14
+
15
+ <button id="save" class="floating-button mdl-button mdl-js-button mdl-button--fab mdl-js-ripple-effect mdl-button--colored">
16
+ <i class="material-icons">save</i>
17
17
  </button>