mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-02-28 01:21:13 +01:00
fix: #7798, fix nested post selection
This commit is contained in:
@@ -18,8 +18,14 @@ define('postSelect', ['components'], function (components) {
|
|||||||
disableClicksOnPosts();
|
disableClicksOnPosts();
|
||||||
};
|
};
|
||||||
|
|
||||||
function onPostClicked() {
|
function onPostClicked(ev) {
|
||||||
PostSelect.togglePostSelection($(this));
|
ev.stopPropagation();
|
||||||
|
var pidClicked = $(this).attr('data-pid');
|
||||||
|
var postEls = $('[component="topic"] [data-pid="' + pidClicked + '"]');
|
||||||
|
if (!allowMainPostSelect && parseInt($(this).attr('data-index'), 10) === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
PostSelect.togglePostSelection(postEls, pidClicked);
|
||||||
}
|
}
|
||||||
|
|
||||||
PostSelect.disable = function () {
|
PostSelect.disable = function () {
|
||||||
@@ -31,21 +37,15 @@ define('postSelect', ['components'], function (components) {
|
|||||||
enableClicksOnPosts();
|
enableClicksOnPosts();
|
||||||
};
|
};
|
||||||
|
|
||||||
PostSelect.togglePostSelection = function (post) {
|
PostSelect.togglePostSelection = function (postEls, pid) {
|
||||||
var newPid = post.attr('data-pid');
|
if (pid) {
|
||||||
|
var index = PostSelect.pids.indexOf(pid);
|
||||||
if (!allowMainPostSelect && parseInt(post.attr('data-index'), 10) === 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (newPid) {
|
|
||||||
var index = PostSelect.pids.indexOf(newPid);
|
|
||||||
if (index === -1) {
|
if (index === -1) {
|
||||||
PostSelect.pids.push(newPid);
|
PostSelect.pids.push(pid);
|
||||||
post.toggleClass('bg-success', true);
|
postEls.toggleClass('bg-success', true);
|
||||||
} else {
|
} else {
|
||||||
PostSelect.pids.splice(index, 1);
|
PostSelect.pids.splice(index, 1);
|
||||||
post.toggleClass('bg-success', false);
|
postEls.toggleClass('bg-success', false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PostSelect.pids.length) {
|
if (PostSelect.pids.length) {
|
||||||
@@ -57,7 +57,6 @@ define('postSelect', ['components'], function (components) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
function disableClicks() {
|
function disableClicks() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user