mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-15 20:13:02 +01:00
feat: introduce new front-end UI button for cross-posting, hide move on topics in remote cids
- Hide the ability to select remote cids in topic move category search - Add a new option to category search: 'localOnly'; pretty self descriptive.
This commit is contained in:
@@ -116,6 +116,7 @@
|
||||
"thread-tools.lock": "Lock Topic",
|
||||
"thread-tools.unlock": "Unlock Topic",
|
||||
"thread-tools.move": "Move Topic",
|
||||
"thread-tools.crosspost": "Crosspost Topic",
|
||||
"thread-tools.move-posts": "Move Posts",
|
||||
"thread-tools.move-all": "Move All",
|
||||
"thread-tools.change-owner": "Change Owner",
|
||||
|
||||
@@ -34,6 +34,7 @@ define('forum/topic/move', [
|
||||
categorySelector.init(dropdownEl, {
|
||||
onSelect: onCategorySelected,
|
||||
privilege: 'moderate',
|
||||
localOnly: true,
|
||||
});
|
||||
|
||||
modal.find('#move_thread_commit').on('click', onCommitClicked);
|
||||
|
||||
@@ -116,6 +116,10 @@ define('forum/topic/threadTools', [
|
||||
return false;
|
||||
});
|
||||
|
||||
topicContainer.on('click', '[component="topic/crosspost"]', () => {
|
||||
console.log('tbd');
|
||||
});
|
||||
|
||||
topicContainer.on('click', '[component="topic/delete/posts"]', function () {
|
||||
require(['forum/topic/delete-posts'], function (deletePosts) {
|
||||
deletePosts.init();
|
||||
|
||||
@@ -76,6 +76,7 @@ define('categorySearch', ['alerts', 'bootstrap', 'api'], function (alerts, boots
|
||||
privilege: options.privilege,
|
||||
states: options.states,
|
||||
showLinks: options.showLinks,
|
||||
localOnly: options.localOnly,
|
||||
}, function (err, { categories }) {
|
||||
if (err) {
|
||||
return alerts.error(err);
|
||||
|
||||
@@ -66,6 +66,7 @@ async function findMatchedCids(uid, data) {
|
||||
query: data.search,
|
||||
qs: data.query,
|
||||
paginate: false,
|
||||
localOnly: data.localOnly,
|
||||
});
|
||||
|
||||
let matchedCids = result.categories.map(c => c.cid);
|
||||
|
||||
@@ -6,12 +6,14 @@ const privileges = require('../privileges');
|
||||
const activitypub = require('../activitypub');
|
||||
const plugins = require('../plugins');
|
||||
const db = require('../database');
|
||||
const utils = require('../utils');
|
||||
|
||||
module.exports = function (Categories) {
|
||||
Categories.search = async function (data) {
|
||||
const query = data.query || '';
|
||||
const page = data.page || 1;
|
||||
const uid = data.uid || 0;
|
||||
const localOnly = data.localOnly || false;
|
||||
const paginate = data.hasOwnProperty('paginate') ? data.paginate : true;
|
||||
|
||||
const startTime = process.hrtime();
|
||||
@@ -21,6 +23,9 @@ module.exports = function (Categories) {
|
||||
}
|
||||
|
||||
let cids = await findCids(query, data.hardCap);
|
||||
if (localOnly) {
|
||||
cids = cids.filter(cid => utils.isNumber(cid));
|
||||
}
|
||||
|
||||
const result = await plugins.hooks.fire('filter:categories.search', {
|
||||
data: data,
|
||||
|
||||
@@ -15,9 +15,15 @@
|
||||
<a component="topic/unpin" href="#" class="dropdown-item rounded-1 d-flex align-items-center gap-2 {{{ if !pinned }}}hidden{{{ end }}}" role="menuitem"><i class="fa fa-fw fa-thumb-tack fa-rotate-90 text-secondary"></i> [[topic:thread-tools.unpin]]</a>
|
||||
</li>
|
||||
|
||||
{{{ if isNumber(cid) }}}
|
||||
<li>
|
||||
<a component="topic/move" href="#" class="dropdown-item rounded-1 d-flex align-items-center gap-2" role="menuitem"><i class="fa fa-fw fa-arrows text-secondary"></i> [[topic:thread-tools.move]]</a>
|
||||
</li>
|
||||
{{{ end }}}
|
||||
|
||||
<li>
|
||||
<a component="topic/crosspost" href="#" class="dropdown-item rounded-1 d-flex align-items-center gap-2" role="menuitem"><i class="fa fa-fw fa-clone text-secondary"></i> [[topic:thread-tools.crosspost]]</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a component="topic/merge" href="#" class="dropdown-item rounded-1 d-flex align-items-center gap-2" role="menuitem"><i class="fa fa-fw fa-code-fork text-secondary"></i> [[topic:thread-tools.merge]]</a>
|
||||
|
||||
Reference in New Issue
Block a user