From bee3c06a0712dafd1fbea8ca98637645b04ccd0f Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Sat, 4 Jan 2014 21:41:22 -0500 Subject: [PATCH] clicking 'quote' now shows the quoted username before said quote --- public/src/forum/topic.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/public/src/forum/topic.js b/public/src/forum/topic.js index 0a64153249..6ad6120977 100644 --- a/public/src/forum/topic.js +++ b/public/src/forum/topic.js @@ -269,7 +269,7 @@ define(['composer'], function(composer) { var username = '', post = $(this).parents('li[data-pid]'); - if(post.length) { + if (post.length) { username = '@' + post.attr('data-username') + ' '; } @@ -280,13 +280,19 @@ define(['composer'], function(composer) { $('#post-container').on('click', '.quote', function() { if (thread_state.locked !== '1') { - var pid = $(this).parents('li').attr('data-pid'); + var username = '', + post = $(this).parents('li[data-pid]'), + pid = $(this).parents('li').attr('data-pid'); + + if (post.length) { + username = '@' + post.attr('data-username'); + } socket.emit('api:posts.getRawPost', {pid: pid}, function(data) { quoted = '> ' + data.post.replace(/\n/g, '\n> ') + '\n\n'; - composer.newReply(tid, topic_name, quoted); + composer.newReply(tid, topic_name, username + ' said:\n' + quoted); }); } });