mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-05 05:25:49 +01:00
select the current category on open
This commit is contained in:
committed by
GitHub
parent
d2066f59c0
commit
6b51dd5a2f
@@ -50,7 +50,7 @@ SocketTopics.createTopicFromPosts = async function (socket, data) {
|
||||
throw new Error('[[error:invalid-data]]');
|
||||
}
|
||||
|
||||
const result = await topics.createTopicFromPosts(socket.uid, data.title, data.pids, data.fromTid);
|
||||
const result = await topics.createTopicFromPosts(socket.uid, data.title, data.pids, data.fromTid, data.cid);
|
||||
await events.log({
|
||||
type: `topic-fork`,
|
||||
uid: socket.uid,
|
||||
|
||||
@@ -9,7 +9,7 @@ const plugins = require('../plugins');
|
||||
const meta = require('../meta');
|
||||
|
||||
module.exports = function (Topics) {
|
||||
Topics.createTopicFromPosts = async function (uid, title, pids, fromTid) {
|
||||
Topics.createTopicFromPosts = async function (uid, title, pids, fromTid, cid) {
|
||||
if (title) {
|
||||
title = title.trim();
|
||||
}
|
||||
@@ -27,7 +27,9 @@ module.exports = function (Topics) {
|
||||
pids.sort((a, b) => a - b);
|
||||
|
||||
const mainPid = pids[0];
|
||||
const cid = await posts.getCidByPid(mainPid);
|
||||
if (!cid) {
|
||||
cid = await posts.getCidByPid(mainPid);
|
||||
}
|
||||
|
||||
const [postData, isAdminOrMod] = await Promise.all([
|
||||
posts.getPostData(mainPid),
|
||||
|
||||
@@ -10,7 +10,13 @@
|
||||
<label class="form-label" for="fork-title"><strong>[[topic:title]]</strong></label>
|
||||
<input id="fork-title" type="text" class="form-control" placeholder="[[topic:enter-new-topic-title]]">
|
||||
</div>
|
||||
<strong><span id="fork-pids"></span></strong>
|
||||
<div class="mb-3">
|
||||
<label class="form-label"><strong>[[category:category]]</strong></label>
|
||||
<div>
|
||||
<!-- IMPORT partials/category/selector-dropdown-right.tpl -->
|
||||
</div>
|
||||
</div>
|
||||
<strong id="fork-pids"></strong>
|
||||
</div>
|
||||
<div class="card-footer text-end">
|
||||
<button class="btn btn-link btn-sm" id="fork_thread_cancel">[[global:buttons.close]]</button>
|
||||
|
||||
Reference in New Issue
Block a user