{posts.content}
- {posts.timestamp} ago
+ {posts.relativeTime} ago
diff --git a/src/feed.js b/src/feed.js
index f40e2b5129..a13a391167 100644
--- a/src/feed.js
+++ b/src/feed.js
@@ -36,7 +36,7 @@
}
function getPostsData(next) {
- posts.getPostsByTid(tid, 0, -20, -1, function(postsData) {
+ posts.getPostsByTid(tid, -20, -1, function(postsData) {
next(null, postsData);
});
}
diff --git a/src/posts.js b/src/posts.js
index a34a2751a9..ed850fc74f 100644
--- a/src/posts.js
+++ b/src/posts.js
@@ -14,13 +14,14 @@ marked.setOptions({
});
(function(Posts) {
- Posts.getPostsByTid = function(tid, current_user, start, end, callback) {
+
+ Posts.getPostsByTid = function(tid, start, end, callback) {
RDB.lrange('tid:' + tid + ':posts', start, end, function(err, pids) {
+
RDB.handle(err);
- topics.markAsRead(tid, current_user);
if (pids.length) {
- Posts.getPostsByPids(pids, current_user, function(posts) {
+ Posts.getPostsByPids(pids, function(posts) {
callback(posts);
});
} else {
@@ -63,97 +64,58 @@ marked.setOptions({
});
};
- Posts.getPostsByPids = function(pids, current_user, callback) {
- var content = [], uid = [], timestamp = [], post_rep = [], editor = [], editTime = [], deleted = [], tid = [];
+ Posts.getPostData = function(pid, callback) {
+ RDB.hgetall('post:' + pid, function(err, data) {
+ if(err === null)
+ callback(data);
+ else
+ console.log(err);
+ });
+ }
- for (var i=0, ii=pids.length; i