Skip to content

Node.js based forum software built for the modern web

fix: quote tooltip leaked into topics without reply privilege (#14910)

palmoni562a7c611da6f
diff --git a/public/src/client/topic/postTools.js b/public/src/client/topic/postTools.js
index bb3d1d38d7..e62f45f45a 100644
--- a/public/src/client/topic/postTools.js
+++ b/public/src/client/topic/postTools.js
@@ -480,24 +480,20 @@ define('forum/topic/postTools', [
const selectionChangeFn = utils.debounce(selectionChange, 250);
function handleSelectionTooltip() {
+ $(document).off('selectionchange', selectionChangeFn);
if (!ajaxify.data.privileges['topics:reply']) {
return;
}
hooks.onPage('action:posts.loaded', delayedTooltip);
- $(document).off('selectionchange');
- $(document).on('selectionchange', function () {
- const selectionEmpty = window.getSelection().toString() === '';
- if (selectionEmpty) {
- $('[component="selection/tooltip"]').addClass('hidden');
- }
- });
$(document).on('selectionchange', selectionChangeFn);
}
function selectionChange() {
const selectionEmpty = window.getSelection().toString() === '';
- if (!selectionEmpty) {
+ if (selectionEmpty) {
+ $('[component="selection/tooltip"]').addClass('hidden');
+ } else {
delayedTooltip();
}
}