removing topic from listing if deleted, and adding lock icon if thread is locked

v1.18.x
Julian Lam 12 years ago
parent 2ce70dbb93
commit d35bffa830

@ -2,7 +2,7 @@
<ul class="topic-container"> <ul class="topic-container">
<!-- BEGIN topics --> <!-- BEGIN topics -->
<a href="../../topic/{topics.slug}"><li class="topic-row"> <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> <p>Posted {topics.relativeTime} ago by <span class="username">{topics.username}</span>. {topics.post_count} posts.</p>
</li></a> </li></a>
<!-- END topics --> <!-- END topics -->

@ -262,7 +262,7 @@
// Spawn a 'deleted' notice at the top of the page // Spawn a 'deleted' notice at the top of the page
deleteNotice.setAttribute('id', 'thread-deleted'); deleteNotice.setAttribute('id', 'thread-deleted');
deleteNotice.className = 'alert'; 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); document.getElementById('content').insertBefore(deleteNotice, threadEl);
thread_state.deleted = '1'; thread_state.deleted = '1';

@ -34,7 +34,7 @@ var RDB = require('./redis.js'),
'user_rep' : user_data[uid].reputation || 0, 'user_rep' : user_data[uid].reputation || 0,
'gravatar' : user_data[uid].picture, 'gravatar' : user_data[uid].picture,
'fav_star_class' : vote_data[pid] ? 'icon-star' : 'icon-star-empty', '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'
}); });
} }

@ -24,14 +24,18 @@ var RDB = require('./redis.js'),
uid = [], uid = [],
timestamp = [], timestamp = [],
slug = [], slug = [],
postcount = []; postcount = [],
locked = [],
deleted = [];
for (var i=0, ii=tids.length; i<ii; i++) { for (var i=0, ii=tids.length; i<ii; i++) {
title.push('tid:' + tids[i] + ':title'); title.push('tid:' + tids[i] + ':title');
uid.push('tid:' + tids[i] + ':uid'); uid.push('tid:' + tids[i] + ':uid');
timestamp.push('tid:' + tids[i] + ':timestamp'); timestamp.push('tid:' + tids[i] + ':timestamp');
slug.push('tid:' + tids[i] + ':slug'); 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) { if (tids.length > 0) {
@ -41,20 +45,22 @@ var RDB = require('./redis.js'),
.mget(timestamp) .mget(timestamp)
.mget(slug) .mget(slug)
.mget(postcount) .mget(postcount)
.mget(locked)
.mget(deleted)
.exec(function(err, replies) { .exec(function(err, replies) {
title = replies[0]; title = replies[0];
uid = replies[1]; uid = replies[1];
timestamp = replies[2]; timestamp = replies[2];
slug = replies[3]; slug = replies[3];
postcount = replies[4]; postcount = replies[4];
locked = replies[5];
deleted = replies[6];
user.get_usernames_by_uids(uid, function(userNames) { user.get_usernames_by_uids(uid, function(userNames) {
var topics = []; var topics = [];
for (var i=0, ii=title.length; i<ii; i++) { for (var i=0, ii=title.length; i<ii; i++) {
if (deleted[i] === '1') continue;
topics.push({ topics.push({
'title' : title[i], 'title' : title[i],
@ -63,7 +69,9 @@ var RDB = require('./redis.js'),
'timestamp' : timestamp[i], 'timestamp' : timestamp[i],
'relativeTime': utils.relativeTime(timestamp[i]), 'relativeTime': utils.relativeTime(timestamp[i]),
'slug' : slug[i], 'slug' : slug[i],
'post_count' : postcount[i] 'post_count' : postcount[i],
icon: locked[i] === '1' ? 'icon-lock' : 'hide',
deleted: deleted[i]
}); });
} }

Loading…
Cancel
Save