Node.js based forum software built for the modern web
closes #4322
barisusakli7bf808d0f465
diff --git a/public/src/client/topic/postTools.js b/public/src/client/topic/postTools.jsindex 9ac20b1ac4..28701dd56a 100644--- a/public/src/client/topic/postTools.js+++ b/public/src/client/topic/postTools.js@@ -35,7 +35,7 @@ define('forum/topic/postTools', ['share', 'navigator', 'components', 'translator}data.posts.display_move_tools = data.posts.display_move_tools && index !== 0;data.postSharing = data.postSharing.filter(function(share) { return share.activated === true; });-+templates.parse('partials/topic/post-menu-list', data, function(html) {translator.translate(html, function(html) {dropdownMenu.html(html);@@ -181,14 +181,16 @@ define('forum/topic/postTools', ['share', 'navigator', 'components', 'translatorfunction onReplyClicked(button, tid) {showStaleWarning(function(proceed) {if (!proceed) {- var selectionText = '',- selection = window.getSelection ? window.getSelection() : document.selection.createRange();+ var selectionText = '';+ var selection = window.getSelection ? window.getSelection() : document.selection.createRange();+ var selectionNode = $(selection.baseNode || selection.anchorNode);- if ($(selection.baseNode).parents('[component="post/content"]').length > 0) {+ if (selectionNode.parents('[component="post/content"]').length > 0) {selectionText = selection.toString();}- var username = getUserName(selectionText ? $(selection.baseNode) : button);+ button = selectionText ? selectionNode : button;+ var username = getUserName(button);if (getData(button, 'data-uid') === '0' || !getData(button, 'data-userslug')) {username = '';}@@ -308,11 +310,13 @@ define('forum/topic/postTools', ['share', 'navigator', 'components', 'translator}function getUserName(button) {- var username = '',- post = button.parents('[data-pid]');+ var username = '';+ var post = button.parents('[data-pid]');+if (button.attr('component') === 'topic/reply') {return username;}+if (post.length) {username = post.attr('data-username').replace(/\s/g, '-');}