This commit is contained in:
Baris Usakli
2013-09-19 15:02:35 -04:00
parent 27cb837b08
commit efef9c864c
13 changed files with 35 additions and 28 deletions

View File

@@ -21,7 +21,6 @@ var RDB = require('./../redis.js'),
// reset slugs if name is updated
var slug = cid + '/' + utils.slugify(category[key]);
RDB.hset('category:' + cid, 'slug', slug);
RDB.set('categoryslug:' + slug + ':cid', cid);
}
}

View File

@@ -70,7 +70,7 @@ var RDB = require('./redis.js'),
Posts.getPostFields(pid, ['pid', 'tid', 'content', 'uid', 'timestamp', 'deleted'], function(postData) {
if (postData.deleted === '1') return callback(null);
else {
postData.relativeTime = utils.relativeTime(postData.timestamp);
postData.relativeTime = new Date(parseInt(postData.timestamp, 10)).toISOString();
next(null, postData);
}
});
@@ -159,10 +159,10 @@ var RDB = require('./redis.js'),
async.eachSeries(pids, function(pid, callback) {
Posts.getPostData(pid, function(postData) {
if (postData) {
postData.relativeTime = utils.relativeTime(postData.timestamp);
postData.relativeTime = new Date(parseInt(postData.timestamp,10)).toISOString();
postData.post_rep = postData.reputation;
postData['edited-class'] = postData.editor !== '' ? '' : 'none';
postData['relativeEditTime'] = postData.edited !== '0' ? utils.relativeTime(postData.edited) : '';
postData['relativeEditTime'] = postData.edited !== '0' ? (new Date(parseInt(postData.edited,10)).toISOString()) : '';
postTools.toHTML(postData.content, function(err, content) {
postData.content = content;
@@ -285,7 +285,7 @@ var RDB = require('./redis.js'),
'fav_button_class': '',
'fav_star_class': 'icon-star-empty',
'show_banned': 'hide',
'relativeTime': '0 seconds',
'relativeTime': new Date(timestamp).toISOString(),
'post_rep': '0',
'edited-class': 'none',
'relativeEditTime': ''

View File

@@ -482,7 +482,7 @@ var user = require('./../user.js'),
user.getUserData(uid, function(err, data) {
if (data) {
data.joindate = utils.relativeTime(data.joindate);
data.joindate = new Date(parseInt(data.joindate, 10)).toISOString();
if (!data.birthday) {
data.age = '';

View File

@@ -305,14 +305,15 @@ schema = require('./schema.js'),
topicData['lock-icon'] = topicData.locked === '1' ? 'icon-lock' : 'none';
topicData['deleted-class'] = topicData.deleted === '1' ? 'deleted' : '';
topicData.relativeTime = utils.relativeTime(topicData.timestamp);
topicData.relativeTime = new Date(parseInt(topicData.timestamp, 10)).toISOString();
topicData.username = topicInfo.username;
topicData.badgeclass = (topicInfo.hasread && current_user != 0) ? '' : 'badge-important';
topicData.teaser_text = topicInfo.teaserInfo.text || '',
topicData.teaser_username = topicInfo.teaserInfo.username || '';
topicData.teaser_userpicture = topicInfo.teaserInfo.picture || '';
topicData.teaser_timestamp = topicInfo.teaserInfo.timestamp ? utils.relativeTime(topicInfo.teaserInfo.timestamp) : '';
topicData.teaser_timestamp = topicInfo.teaserInfo.timestamp ? (new Date(parseInt(topicInfo.teaserInfo.timestamp, 10)).toISOString()) : '';
if (isTopicVisible(topicData, topicInfo))
retrieved_topics.push(topicData);
@@ -426,11 +427,11 @@ schema = require('./schema.js'),
hasRead = results[1],
teaser = results[2];
topicData.relativeTime = utils.relativeTime(topicData.timestamp);
topicData.relativeTime = new Date(parseInt(topicData.timestamp,10)).toISOString();
topicData.badgeclass = hasRead ? '' : 'badge-important';
topicData.teaser_text = teaser.text || '';
topicData.teaser_username = teaser.username || '';
topicData.teaser_timestamp = teaser.timestamp ? utils.relativeTime(teaser.timestamp) : '';
topicData.teaser_timestamp = teaser.timestamp ? (new Date(parseInt(teaser.timestamp,10)).toISOString()) : '';
topicData.teaser_userpicture = teaser.picture;
callback(topicData);