From ff9d7c6c24bd2cb3c61eb064b8eba1e90e632e88 Mon Sep 17 00:00:00 2001
From: psychobunny <psycho.bunny@hotmail.com>
Date: Mon, 10 Feb 2014 10:45:24 -0500
Subject: [PATCH 1/3] removed unnecessary conditionals from app.updateHeader

---
 public/src/app.js | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/public/src/app.js b/public/src/app.js
index 725e31ca7e..80874543e8 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);
 

From 92d029f072b955344b81409cdade20ec6a25afe1 Mon Sep 17 00:00:00 2001
From: Julian Lam <julian@designcreateplay.com>
Date: Mon, 10 Feb 2014 11:41:25 -0500
Subject: [PATCH 2/3] removed regex removal of @first block on infinite post
 load in favour of DOM method

---
 public/src/forum/topic.js | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/public/src/forum/topic.js b/public/src/forum/topic.js
index dde3643777..77865e651e 100644
--- a/public/src/forum/topic.js
+++ b/public/src/forum/topic.js
@@ -1217,15 +1217,19 @@ define(['composer', 'forum/pagination'], function(composer, pagination) {
 				.hide()
 				.fadeIn('slow');
 
+			// Remove the extra post-bar that gets added
+			$('.posts').find('.post-bar[data-index]').each(function(idx, el) {
+				if (el.getAttribute('data-index')) {
+					el.parentNode.removeChild(el);
+				}
+			});
+
 			onNewPostsLoaded(data.posts);
 		});
 	}
 
 	function parseAndTranslatePosts(data, callback) {
 		var html = templates.prepare(templates['topic'].blocks['posts']).parse(data);
-		var regexp = new RegExp("<!--[\\s]*IF @first[\\s]*-->([\\s\\S]*?)<!--[\\s]*ENDIF @first[\\s]*-->", 'g');
-		html = html.replace(regexp, '');
-
 		translator.translate(html, callback);
 	}
 

From 5b8585fafba594b77ebba53755c2c89ac67a9921 Mon Sep 17 00:00:00 2001
From: Julian Lam <julian@designcreateplay.com>
Date: Mon, 10 Feb 2014 11:54:47 -0500
Subject: [PATCH 3/3] fixed #985

---
 public/src/forum/topic.js | 13 ++++++++++---
 src/posts.js              |  3 ++-
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/public/src/forum/topic.js b/public/src/forum/topic.js
index 77865e651e..a869e6fd1a 100644
--- a/public/src/forum/topic.js
+++ b/public/src/forum/topic.js
@@ -1217,12 +1217,19 @@ define(['composer', 'forum/pagination'], function(composer, pagination) {
 				.hide()
 				.fadeIn('slow');
 
-			// Remove the extra post-bar that gets added
-			$('.posts').find('.post-bar[data-index]').each(function(idx, el) {
-				if (el.getAttribute('data-index')) {
+			// 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);
 		});
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