mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-03-19 02:50:53 +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.lock": "Lock Topic",
|
||||||
"thread-tools.unlock": "Unlock Topic",
|
"thread-tools.unlock": "Unlock Topic",
|
||||||
"thread-tools.move": "Move Topic",
|
"thread-tools.move": "Move Topic",
|
||||||
|
"thread-tools.crosspost": "Crosspost Topic",
|
||||||
"thread-tools.move-posts": "Move Posts",
|
"thread-tools.move-posts": "Move Posts",
|
||||||
"thread-tools.move-all": "Move All",
|
"thread-tools.move-all": "Move All",
|
||||||
"thread-tools.change-owner": "Change Owner",
|
"thread-tools.change-owner": "Change Owner",
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ define('forum/topic/move', [
|
|||||||
categorySelector.init(dropdownEl, {
|
categorySelector.init(dropdownEl, {
|
||||||
onSelect: onCategorySelected,
|
onSelect: onCategorySelected,
|
||||||
privilege: 'moderate',
|
privilege: 'moderate',
|
||||||
|
localOnly: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
modal.find('#move_thread_commit').on('click', onCommitClicked);
|
modal.find('#move_thread_commit').on('click', onCommitClicked);
|
||||||
|
|||||||
@@ -116,6 +116,10 @@ define('forum/topic/threadTools', [
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
topicContainer.on('click', '[component="topic/crosspost"]', () => {
|
||||||
|
console.log('tbd');
|
||||||
|
});
|
||||||
|
|
||||||
topicContainer.on('click', '[component="topic/delete/posts"]', function () {
|
topicContainer.on('click', '[component="topic/delete/posts"]', function () {
|
||||||
require(['forum/topic/delete-posts'], function (deletePosts) {
|
require(['forum/topic/delete-posts'], function (deletePosts) {
|
||||||
deletePosts.init();
|
deletePosts.init();
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ define('categorySearch', ['alerts', 'bootstrap', 'api'], function (alerts, boots
|
|||||||
privilege: options.privilege,
|
privilege: options.privilege,
|
||||||
states: options.states,
|
states: options.states,
|
||||||
showLinks: options.showLinks,
|
showLinks: options.showLinks,
|
||||||
|
localOnly: options.localOnly,
|
||||||
}, function (err, { categories }) {
|
}, function (err, { categories }) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return alerts.error(err);
|
return alerts.error(err);
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ async function findMatchedCids(uid, data) {
|
|||||||
query: data.search,
|
query: data.search,
|
||||||
qs: data.query,
|
qs: data.query,
|
||||||
paginate: false,
|
paginate: false,
|
||||||
|
localOnly: data.localOnly,
|
||||||
});
|
});
|
||||||
|
|
||||||
let matchedCids = result.categories.map(c => c.cid);
|
let matchedCids = result.categories.map(c => c.cid);
|
||||||
|
|||||||
@@ -6,12 +6,14 @@ const privileges = require('../privileges');
|
|||||||
const activitypub = require('../activitypub');
|
const activitypub = require('../activitypub');
|
||||||
const plugins = require('../plugins');
|
const plugins = require('../plugins');
|
||||||
const db = require('../database');
|
const db = require('../database');
|
||||||
|
const utils = require('../utils');
|
||||||
|
|
||||||
module.exports = function (Categories) {
|
module.exports = function (Categories) {
|
||||||
Categories.search = async function (data) {
|
Categories.search = async function (data) {
|
||||||
const query = data.query || '';
|
const query = data.query || '';
|
||||||
const page = data.page || 1;
|
const page = data.page || 1;
|
||||||
const uid = data.uid || 0;
|
const uid = data.uid || 0;
|
||||||
|
const localOnly = data.localOnly || false;
|
||||||
const paginate = data.hasOwnProperty('paginate') ? data.paginate : true;
|
const paginate = data.hasOwnProperty('paginate') ? data.paginate : true;
|
||||||
|
|
||||||
const startTime = process.hrtime();
|
const startTime = process.hrtime();
|
||||||
@@ -21,6 +23,9 @@ module.exports = function (Categories) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let cids = await findCids(query, data.hardCap);
|
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', {
|
const result = await plugins.hooks.fire('filter:categories.search', {
|
||||||
data: data,
|
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>
|
<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>
|
</li>
|
||||||
|
|
||||||
|
{{{ if isNumber(cid) }}}
|
||||||
<li>
|
<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>
|
<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>
|
</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>
|
<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>
|
<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