Node.js based forum software built for the modern web
removing topic from listing if deleted, and adding lock icon if thread is locked
Julian Lamd35bffa83023
diff --git a/public/templates/category.tpl b/public/templates/category.tplindex 513070c198..21516dfed2 100644--- a/public/templates/category.tpl+++ b/public/templates/category.tpl@@ -2,7 +2,7 @@<ul class="topic-container"><!-- BEGIN topics --><a href="../../topic/{topics.slug}"><li class="topic-row">- <h4>{topics.title}</h4>+ <h4><i class="{topics.icon}"></i> {topics.title}</h4><p>Posted {topics.relativeTime} ago by <span class="username">{topics.username}</span>. {topics.post_count} posts.</p></li></a><!-- END topics -->diff --git a/public/templates/topic.tpl b/public/templates/topic.tplindex a59dfda400..2166b2ffe5 100644--- a/public/templates/topic.tpl+++ b/public/templates/topic.tpl@@ -262,7 +262,7 @@// Spawn a 'deleted' notice at the top of the pagedeleteNotice.setAttribute('id', 'thread-deleted');deleteNotice.className = 'alert';- deleteNotice.innerHTML = 'This thread has been deleted. Only users with thread management privileges can see it.';+ deleteNotice.innerHTML = 'This thread has been deleted. Only users with thread management privileges can see it.<br /><br /><a href="/">Home</a>';document.getElementById('content').insertBefore(deleteNotice, threadEl);thread_state.deleted = '1';diff --git a/src/posts.js b/src/posts.jsindex b34d926940..6683ed6307 100644--- a/src/posts.js+++ b/src/posts.js@@ -34,7 +34,7 @@ var RDB = require('./redis.js'),'user_rep' : user_data[uid].reputation || 0,'gravatar' : user_data[uid].picture,'fav_star_class' : vote_data[pid] ? 'icon-star' : 'icon-star-empty',- 'display_moderator_tools' : uid === current_user ? 'show' : 'hide'+ 'display_moderator_tools' : uid == current_user ? 'show' : 'hide'});}diff --git a/src/topics.js b/src/topics.jsindex 5818fe0364..a71103efcc 100644--- a/src/topics.js+++ b/src/topics.js@@ -24,14 +24,18 @@ var RDB = require('./redis.js'),uid = [],timestamp = [],slug = [],- postcount = [];+ postcount = [],+ locked = [],+ deleted = [];for (var i=0, ii=tids.length; i<ii; i++) {title.push('tid:' + tids[i] + ':title');uid.push('tid:' + tids[i] + ':uid');timestamp.push('tid:' + tids[i] + ':timestamp');slug.push('tid:' + tids[i] + ':slug');- postcount.push('tid:' + tids[i] + ':postcount');+ postcount.push('tid:' + tids[i] + ':postcount'),+ locked.push('tid:' + tids[i] + ':locked'),+ deleted.push('tid:' + tids[i] + ':deleted');}if (tids.length > 0) {@@ -41,21 +45,23 @@ var RDB = require('./redis.js'),.mget(timestamp).mget(slug).mget(postcount)+ .mget(locked)+ .mget(deleted).exec(function(err, replies) {-title = replies[0];uid = replies[1];timestamp = replies[2];slug = replies[3];postcount = replies[4];---+ locked = replies[5];+ deleted = replies[6];+user.get_usernames_by_uids(uid, function(userNames) {var topics = [];for (var i=0, ii=title.length; i<ii; i++) {-+ if (deleted[i] === '1') continue;+topics.push({'title' : title[i],'uid' : uid[i],@@ -63,7 +69,9 @@ var RDB = require('./redis.js'),'timestamp' : timestamp[i],'relativeTime': utils.relativeTime(timestamp[i]),'slug' : slug[i],- 'post_count' : postcount[i]+ 'post_count' : postcount[i],+ icon: locked[i] === '1' ? 'icon-lock' : 'hide',+ deleted: deleted[i]});}