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">
<!-- 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 -->

@ -262,7 +262,7 @@
// Spawn a 'deleted' notice at the top of the page
deleteNotice.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';

@ -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'
});
}

@ -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]
});
}

Loading…
Cancel
Save