mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-03-18 02:20:49 +01:00
feat: add category selector to /world quick composer
This commit is contained in:
@@ -208,5 +208,6 @@
|
||||
"activitypubUserPruneDays": 7,
|
||||
"activitypubFilter": 0,
|
||||
"activitypubSummaryLimit": 500,
|
||||
"activitypubBreakString": "[...]"
|
||||
"activitypubBreakString": "[...]",
|
||||
"activitypubWorldDefaultCid": -1
|
||||
}
|
||||
|
||||
@@ -108,10 +108,10 @@
|
||||
"nodebb-plugin-spam-be-gone": "2.3.2",
|
||||
"nodebb-plugin-web-push": "0.7.7",
|
||||
"nodebb-rewards-essentials": "1.0.2",
|
||||
"nodebb-theme-harmony": "2.2.57",
|
||||
"nodebb-theme-harmony": "2.2.58",
|
||||
"nodebb-theme-lavender": "7.1.21",
|
||||
"nodebb-theme-peace": "2.2.57",
|
||||
"nodebb-theme-persona": "14.2.31",
|
||||
"nodebb-theme-persona": "14.2.32",
|
||||
"nodebb-widget-essentials": "7.0.43",
|
||||
"nodemailer": "8.0.2",
|
||||
"nprogress": "0.2.0",
|
||||
|
||||
@@ -50,5 +50,6 @@
|
||||
"content.summary-limit": "Character count after which a summary is generated",
|
||||
"content.summary-limit-help": "When content is federated out that exceeds this character count, a <code>summary</code> is generated, comprising of all complete sentences prior to this limit. (Default: 500)",
|
||||
"content.break-string": "Note/Article Delimiter",
|
||||
"content.break-string-help": "This delimiter can be manually inserted by power users when composing new topics. It instructs NodeBB to use content up until that point as part of the <code>summary</code>. If this string is not used, then the character count fallback applies. (Default: <code>[...]</code>)"
|
||||
"content.break-string-help": "This delimiter can be manually inserted by power users when composing new topics. It instructs NodeBB to use content up until that point as part of the <code>summary</code>. If this string is not used, then the character count fallback applies. (Default: <code>[...]</code>)",
|
||||
"content.world-default-cid": "Default category ID for "World" page composer"
|
||||
}
|
||||
@@ -3,9 +3,11 @@
|
||||
define('quickreply', [
|
||||
'components', 'autocomplete', 'api',
|
||||
'alerts', 'uploadHelpers', 'mousetrap', 'storage', 'hooks',
|
||||
'categorySelector',
|
||||
], function (
|
||||
components, autocomplete, api,
|
||||
alerts, uploadHelpers, mousetrap, storage, hooks
|
||||
alerts, uploadHelpers, mousetrap, storage, hooks,
|
||||
categorySelector,
|
||||
) {
|
||||
const QuickReply = {
|
||||
_autocomplete: null,
|
||||
@@ -17,6 +19,17 @@ define('quickreply', [
|
||||
return;
|
||||
}
|
||||
|
||||
if ($('[component="topic/quickreply/container"] [component="category-selector"]')) {
|
||||
categorySelector.init($('[component="category-selector"]'), {
|
||||
privilege: 'topics:create',
|
||||
selectedCategory: ajaxify.data.selectedCategory,
|
||||
onSelect: function (category) {
|
||||
opts.body = opts.body || {};
|
||||
opts.body.cid = category.cid;
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
const qrDraftId = ajaxify.data.tid ? `qr:draft:tid:${ajaxify.data.tid}` : `qr:draft:cid:${opts?.body?.cid || -1}`;
|
||||
const data = {
|
||||
element: element,
|
||||
|
||||
@@ -26,10 +26,11 @@ controller.list = async function (req, res) {
|
||||
let start = Math.max(0, (page - 1) * topicsPerPage);
|
||||
let stop = start + topicsPerPage - 1;
|
||||
|
||||
const [userSettings, userPrivileges, isAdminOrGlobalMod] = await Promise.all([
|
||||
const [userSettings, userPrivileges, isAdminOrGlobalMod, selectedCategory] = await Promise.all([
|
||||
user.getSettings(req.uid),
|
||||
privileges.categories.get('-1', req.uid),
|
||||
user.isAdminOrGlobalMod(req.uid),
|
||||
categories.getCategoryData(meta.config.activitypubWorldDefaultCid),
|
||||
]);
|
||||
const targetUid = await user.getUidByUserslug(req.query.author);
|
||||
let cidQuery = {
|
||||
@@ -48,6 +49,7 @@ controller.list = async function (req, res) {
|
||||
delete data.children;
|
||||
data.sort = req.query.sort;
|
||||
data.privileges = userPrivileges;
|
||||
data.selectedCategory = selectedCategory;
|
||||
|
||||
let tids;
|
||||
let topicCount;
|
||||
|
||||
@@ -20,6 +20,10 @@
|
||||
[[admin/settings/activitypub:content.break-string-help]]
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="activitypubWorldDefaultCid">[[admin/settings/activitypub:content.world-default-cid]]</label>
|
||||
<input type="text" id="activitypubWorldDefaultCid" name="activitypubWorldDefaultCid" data-field="activitypubWorldDefaultCid" title="[[admin/settings/activitypub:content.world-default-cid]]" class="form-control" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user