Node.js based forum software built for the modern web
closes #1840
barisusakli161069c39095
diff --git a/public/src/forum/topic/postTools.js b/public/src/forum/topic/postTools.jsindex f41f9b7e32..24d7491fa5 100644--- a/public/src/forum/topic/postTools.js+++ b/public/src/forum/topic/postTools.js@@ -64,7 +64,7 @@ define('forum/topic/postTools', ['composer', 'share', 'navigator'], function(com});postContainer.on('click', '.favourite', function() {- favouritePost($(this), getPid($(this)));+ favouritePost($(this), getData($(this), 'data-pid'));});postContainer.on('click', '.upvote', function() {@@ -76,11 +76,11 @@ define('forum/topic/postTools', ['composer', 'share', 'navigator'], function(com});postContainer.on('click', '.flag', function() {- flagPost(getPid($(this)));+ flagPost(getData($(this), 'data-pid'));});postContainer.on('click', '.edit', function(e) {- composer.editPost(getPid($(this)));+ composer.editPost(getData($(this), 'data-pid'));});postContainer.on('click', '.delete', function(e) {@@ -114,16 +114,16 @@ define('forum/topic/postTools', ['composer', 'share', 'navigator'], function(comvar username = getUserName(selectionText ? $(selection.baseNode) : button);if (selectionText.length) {- composer.addQuote(tid, getPid(button), topicName, username, selectionText);+ composer.addQuote(tid, ajaxify.variables.get('topic_slug'), getData(button, 'data-index'), getData(button, 'data-pid'), topicName, username, selectionText);} else {- composer.newReply(tid, getPid(button), topicName, username ? username + ' ' : '');+ composer.newReply(tid, getData(button, 'data-pid'), topicName, username ? username + ' ' : '');}}function onQuoteClicked(button, tid, topicName) {var username = getUserName(button),- pid = getPid(button);+ pid = getData(button, 'data-pid');socket.emit('posts.getRawPost', pid, function(err, post) {if(err) {@@ -135,7 +135,7 @@ define('forum/topic/postTools', ['composer', 'share', 'navigator'], function(com}if($('.composer').length) {- composer.addQuote(tid, pid, topicName, username, quoted);+ composer.addQuote(tid, ajaxify.variables.get('topic_slug'), getData(button, 'data-index'), pid, topicName, username, quoted);} else {composer.newReply(tid, pid, topicName, '[[modules:composer.user_said, ' + username + ']]' + quoted);}@@ -173,8 +173,8 @@ define('forum/topic/postTools', ['composer', 'share', 'navigator'], function(comreturn false;}- function getPid(button) {- return button.parents('.post-row').attr('data-pid');+ function getData(button, data) {+ return button.parents('.post-row').attr(data);}function getUserName(button) {@@ -188,7 +188,7 @@ define('forum/topic/postTools', ['composer', 'share', 'navigator'], function(com}function deletePost(button, tid) {- var pid = getPid(button),+ var pid = getData(button, 'data-pid'),postEl = $('#post-container li[data-pid="' + pid + '"]'),action = !postEl.hasClass('deleted') ? 'delete' : 'restore';@@ -196,7 +196,7 @@ define('forum/topic/postTools', ['composer', 'share', 'navigator'], function(com}function purgePost(button, tid) {- postAction('purge', getPid(button), tid);+ postAction('purge', getData(button, 'data-pid'), tid);}function postAction(action, pid, tid) {@@ -238,7 +238,7 @@ define('forum/topic/postTools', ['composer', 'share', 'navigator'], function(com});moveBtn.on('click', function() {- movePost(button.parents('.post-row'), getPid(button), topicId.val());+ movePost(button.parents('.post-row'), getData(button, 'data-pid'), topicId.val());});}diff --git a/public/src/modules/composer.js b/public/src/modules/composer.jsindex 84ad64c8b1..b4a98b06df 100644--- a/public/src/modules/composer.js+++ b/public/src/modules/composer.js@@ -115,7 +115,7 @@ define('composer', dependencies, function(taskbar, controls, uploads, formatting});};- composer.addQuote = function(tid, pid, title, username, text){+ composer.addQuote = function(tid, topicSlug, postIndex, pid, title, username, text) {var uuid = composer.active;if (uuid === undefined) {@@ -126,7 +126,7 @@ define('composer', dependencies, function(taskbar, controls, uploads, formattingvar bodyEl = postContainer.find('textarea');var prevText = bodyEl.val();if(tid !== composer.posts[uuid].tid) {- var link = '[' + title + '](/topic/' + tid + '#' + pid + ')';+ var link = '[' + title + '](/topic/' + topicSlug + '/' + (parseInt(postIndex, 10) + 1) + ')';translator.translate('[[modules:composer.user_said_in, ' + username + ', ' + link + ']]', onTranslated);} else {translator.translate('[[modules:composer.user_said, ' + username + ']]', onTranslated);