nodebb-plugin-composer-default 10.3.22 → 10.3.23
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
|
@@ -158,7 +158,7 @@ plugin.filterComposerBuild = async function (hookData) {
|
|
|
158
158
|
isMain = true;
|
|
159
159
|
}
|
|
160
160
|
globalPrivileges['topics:tag'] = canTagTopics;
|
|
161
|
-
const cid =
|
|
161
|
+
const cid = req.query.cid || '';
|
|
162
162
|
const topicTitle = topicData && topicData.title ?
|
|
163
163
|
topicData.title :
|
|
164
164
|
validator.escape(String(req.query.title || ''));
|
|
@@ -198,9 +198,9 @@ plugin.filterComposerBuild = async function (hookData) {
|
|
|
198
198
|
minimumTagLength: meta.config.minimumTagLength || 3,
|
|
199
199
|
maximumTagLength: meta.config.maximumTagLength || 15,
|
|
200
200
|
tagWhitelist: tagWhitelist,
|
|
201
|
-
selectedCategory:
|
|
202
|
-
minTags: categoryData.minTags,
|
|
203
|
-
maxTags: categoryData.maxTags,
|
|
201
|
+
selectedCategory: categoryData || null,
|
|
202
|
+
minTags: categoryData && categoryData.minTags,
|
|
203
|
+
maxTags: categoryData && categoryData.maxTags,
|
|
204
204
|
|
|
205
205
|
isTopic: !!req.query.cid,
|
|
206
206
|
isEditing: isEditing,
|
|
@@ -282,14 +282,14 @@ async function isModerator(req) {
|
|
|
282
282
|
}
|
|
283
283
|
|
|
284
284
|
async function canTag(req) {
|
|
285
|
-
if (
|
|
285
|
+
if (req.query.cid) {
|
|
286
286
|
return await privileges.categories.can('topics:tag', req.query.cid, req.uid);
|
|
287
287
|
}
|
|
288
288
|
return true;
|
|
289
289
|
}
|
|
290
290
|
|
|
291
291
|
async function canSchedule(req) {
|
|
292
|
-
if (
|
|
292
|
+
if (req.query.cid) {
|
|
293
293
|
return await privileges.categories.can('topics:schedule', req.query.cid, req.uid);
|
|
294
294
|
}
|
|
295
295
|
return false;
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
define('composer/categoryList', [
|
|
4
|
-
'categorySelector', 'taskbar', 'api',
|
|
5
|
-
], function (categorySelector, taskbar, api) {
|
|
4
|
+
'categorySelector', 'taskbar', 'api', 'alerts'
|
|
5
|
+
], function (categorySelector, taskbar, api, alerts) {
|
|
6
6
|
const categoryList = {};
|
|
7
7
|
|
|
8
8
|
let selector;
|
|
@@ -71,10 +71,10 @@ define('composer/categoryList', [
|
|
|
71
71
|
};
|
|
72
72
|
|
|
73
73
|
categoryList.updateTaskbar = function (postContainer, postData) {
|
|
74
|
-
if (
|
|
74
|
+
if (postData.cid) {
|
|
75
75
|
api.get(`/categories/${postData.cid}`, {}).then(function (category) {
|
|
76
76
|
updateTaskbarByCategory(postContainer, category);
|
|
77
|
-
});
|
|
77
|
+
}).catch(alerts.error);
|
|
78
78
|
}
|
|
79
79
|
};
|
|
80
80
|
|