diff --git a/public/src/app.js b/public/src/app.js index eda2ecd256..7f79031b20 100644 --- a/public/src/app.js +++ b/public/src/app.js @@ -510,19 +510,17 @@ var socket, var userLabel = loggedInMenu.find('#user_label'); - if (userLabel.length) { - if (data.userslug) { - userLabel.find('#user-profile-link').attr('href', RELATIVE_PATH + '/user/' + data.userslug); - } - if (data.picture) { - userLabel.find('img').attr('src', data.picture); - } - if (data.username) { - userLabel.find('#user-profile-link>span').html(' ' + data.username); - } - - $('#logout-link').on('click', app.logout); + if (data.userslug) { + userLabel.find('#user-profile-link').attr('href', RELATIVE_PATH + '/user/' + data.userslug); } + if (data.picture) { + userLabel.find('img').attr('src', data.picture); + } + if (data.username) { + userLabel.find('#user-profile-link>span').html(' ' + data.username); + } + + $('#logout-link').on('click', app.logout); updateOnlineStatus(data.uid); diff --git a/public/src/forum/topic.js b/public/src/forum/topic.js index dde3643777..a869e6fd1a 100644 --- a/public/src/forum/topic.js +++ b/public/src/forum/topic.js @@ -1217,15 +1217,26 @@ define(['composer', 'forum/pagination'], function(composer, pagination) { .hide() .fadeIn('slow'); + // Remove the extra post-bar and "follow" button that gets added + var postsEl = $('.posts'); + postsEl.find('.post-bar').each(function(idx, el) { + if (idx !== 0) { + el.parentNode.removeChild(el); + } + }); + postsEl.find('li.post-row[data-index]').each(function(idx, el) { + followEl = el.querySelector('.follow'); + if (idx !== 0 && followEl) { + followEl.parentNode.removeChild(followEl); + } + }); + onNewPostsLoaded(data.posts); }); } function parseAndTranslatePosts(data, callback) { var html = templates.prepare(templates['topic'].blocks['posts']).parse(data); - var regexp = new RegExp("([\\s\\S]*?)", 'g'); - html = html.replace(regexp, ''); - translator.translate(html, callback); } diff --git a/src/posts.js b/src/posts.js index c5cfe68644..bd29294bcb 100644 --- a/src/posts.js +++ b/src/posts.js @@ -51,7 +51,8 @@ var db = require('./database'), 'tid': tid, 'content': newContent, 'timestamp': timestamp, - 'reputation': 0, + 'reputation': '0', + 'votes': '0', 'editor': '', 'edited': 0, 'deleted': 0