Skip to content

Node.js based forum software built for the modern web

closes #332

Baris Usakli9a4eb262466d
diff --git a/public/templates/category.tpl b/public/templates/category.tpl
index 0a6a5f34f8..d5cb9186e9 100644
--- a/public/templates/category.tpl
+++ b/public/templates/category.tpl
@@ -29,7 +29,7 @@
<div class="{topic_row_size}">
<ul id="topics-container">
<!-- BEGIN topics -->
- <a href="../../topic/{topics.slug}"><li class="category-item {topics.deleted-class}">
+ <a href="../../topic/{topics.slug}#{topics.teaser_pid}"><li class="category-item {topics.deleted-class}">
<div class="row">
<div class="col-md-12 topic-row">
<div class="latest-post visible-lg visible-md">
diff --git a/src/topics.js b/src/topics.js
index e6380882a5..54d303bdbf 100644
--- a/src/topics.js
+++ b/src/topics.js
@@ -313,6 +313,7 @@ schema = require('./schema.js'),
topicData.teaser_text = topicInfo.teaserInfo.text || '',
topicData.teaser_username = topicInfo.teaserInfo.username || '';
topicData.teaser_userpicture = topicInfo.teaserInfo.picture || '';
+ topicData.teaser_pid = topicInfo.teaserInfo.pid;
topicData.teaser_timestamp = topicInfo.teaserInfo.timestamp ? (new Date(parseInt(topicInfo.teaserInfo.timestamp, 10)).toISOString()) : '';
@@ -575,7 +576,7 @@ schema = require('./schema.js'),
Topics.getTeaser = function(tid, callback) {
threadTools.getLatestUndeletedPid(tid, function(err, pid) {
if (!err) {
- posts.getPostFields(pid, ['content', 'uid', 'timestamp'], function(postData) {
+ posts.getPostFields(pid, ['pid', 'content', 'uid', 'timestamp'], function(postData) {
user.getUserFields(postData.uid, ['username', 'picture'], function(err, userData) {
if (err)
@@ -584,6 +585,7 @@ schema = require('./schema.js'),
var stripped = postData.content,
timestamp = postData.timestamp,
returnObj = {
+ "pid": postData.pid,
"username": userData.username,
"picture": userData.picture,
"timestamp": timestamp