Node.js based forum software built for the modern web
template fixes closes #825
Baris Soner Usakli55d4a5fe3a11
diff --git a/public/src/forum/account.js b/public/src/forum/account.jsindex d3c639cf66..e3c3ec7fe5 100644--- a/public/src/forum/account.js+++ b/public/src/forum/account.js@@ -68,10 +68,6 @@ define(['forum/accountheader'], function(header) {app.openChat(username, theirid);});- $('.user-recent-posts .topic-row').on('click', function() {- ajaxify.go($(this).attr('topic-url'));- });-socket.on('user.isOnline', Account.handleUserOnline);socket.emit('user.isOnline', theirid, Account.handleUserOnline);diff --git a/public/src/forum/category.js b/public/src/forum/category.jsindex e3a8688472..f8c9c5c168 100644--- a/public/src/forum/category.js+++ b/public/src/forum/category.js@@ -155,8 +155,8 @@ define(['composer'], function(composer) {replies += '<li data-pid="'+ posts[i].pid +'">' +'<a href="' + RELATIVE_PATH + '/user/' + posts[i].userslug + '"><img title="' + posts[i].username + '" class="img-rounded user-img" src="' + posts[i].picture + '"/></a>' ++ '<strong><span>'+ posts[i].username + '</span></strong>' +'<a href="' + RELATIVE_PATH + '/topic/' + posts[i].topicSlug + '#' + posts[i].pid + '">' +- '<strong><span>'+ posts[i].username + '</span></strong>' +'<p>' + posts[i].content + '</p>' +'</a>' +'<span class="timeago pull-right" title="' + posts[i].relativeTime + '"></span>' +diff --git a/public/src/forum/topic.js b/public/src/forum/topic.jsindex 90e5ea0cb0..1725bc8347 100644--- a/public/src/forum/topic.js+++ b/public/src/forum/topic.js@@ -522,8 +522,10 @@ define(['composer'], function(composer) {$('#post-container').on('click', '.chat', function(e) {- var username = $(this).parents('li.row').attr('data-username');- var touid = $(this).parents('li.row').attr('data-uid');+ var post = $(this).parents('li.post-row'),+ username = post.attr('data-username'),+ touid = post.attr('data-uid');+app.openChat(username, touid);$(this).parents('.btn-group').find('.dropdown-toggle').click();return false;diff --git a/public/templates/account.tpl b/public/templates/account.tplindex 9b5eae3519..0539f30742 100644--- a/public/templates/account.tpl+++ b/public/templates/account.tpl@@ -108,12 +108,28 @@</div><div class="col-md-6 user-recent-posts">- <!-- BEGIN posts -->- <div class="topic-row img-thumbnail clearfix" topic-url="topic/{posts.tid}/#{posts.pid}">- <span>{posts.content}</span>- <span class="pull-right timeago" title="{posts.relativeTime}"></span>+ <div class="topic-row panel panel-default clearfix">+ <div class="panel-heading">+ <h3 class="panel-title">Recent Posts</h3>+ </div>+ <div class="panel-body">+ <!-- BEGIN posts -->+ <div class="clearfix">+ <p>{posts.content}</p>+ <span class="pull-right">+ <a href="../../topic/{posts.tid}/#{posts.pid}">posted</a>+ in+ <a href="../../category/{posts.categorySlug}">+ <i class="fa {posts.categoryIcon}"></i> {posts.categoryName}+ </a>+ <span class="timeago" title="{posts.relativeTime}"></span>+ </span>+ </div>+ <hr/>+ <!-- END posts -->+ </div></div>- <!-- END posts -->+</div></div>diff --git a/public/templates/category.tpl b/public/templates/category.tplindex 849c042d9a..2001f7f6fe 100644--- a/public/templates/category.tpl+++ b/public/templates/category.tpl@@ -30,54 +30,56 @@<meta itemprop="itemListOrder" content="descending"><!-- BEGIN topics --><li class="category-item {topics.deleted-class}" itemprop="itemListElement">- <div class="row">- <div class="col-md-12 topic-row">- <div>- <a href="../../topic/{topics.slug}" itemprop="url">- <h3>- <meta itemprop="name" content="{topics.title}">-- <span class="topic-title">- <strong><i class="fa {topics.pin-icon}"></i> <i class="fa {topics.lock-icon}"></i></strong>- {topics.title}- </span>- </h3>++ <div class="col-md-12 panel panel-default topic-row">+++ <h3>+ <a href="../../topic/{topics.slug}" itemprop="url">+ <meta itemprop="name" content="{topics.title}">++ <span class="topic-title">+ <strong><i class="fa {topics.pin-icon}"></i> <i class="fa {topics.lock-icon}"></i></strong>+ {topics.title}+ </span>+ </a>+ </h3>++ <small>+ <span class="topic-stats">+ [[category:posts]]+ <strong class="human-readable-number" title="{topics.postcount}">{topics.postcount}</strong>+ </span>+ |+ <span class="topic-stats">+ [[category:views]]+ <strong class="human-readable-number" title="{topics.viewcount}">{topics.viewcount}</strong>+ </span>+ |+ <span>+ <a href="../../user/{topics.userslug}">+ <img class="teaser-pic" src="{topics.picture}" title="{topics.username}"/></a>- <small>- <span class="topic-stats">- [[category:posts]]- <strong class="human-readable-number" title="{topics.postcount}">{topics.postcount}</strong>- </span>- |- <span class="topic-stats">- [[category:views]]- <strong class="human-readable-number" title="{topics.viewcount}">{topics.viewcount}</strong>- </span>- |- <span>- <a href="../../user/{topics.userslug}">- <img class="teaser-pic" src="{topics.picture}" title="{topics.username}"/>- </a>- [[category:posted]] <span class="timeago" title="{topics.relativeTime}"></span>- </span>-- <span class="pull-right hidden-xs">- <!-- IF topics.unreplied -->- [[category:no_replies]]- <!-- ELSE -->- <a href="../../user/{topics.teaser_userslug}">- <img class="teaser-pic" src="{topics.teaser_userpicture}" title="{topics.teaser_username}"/>- </a>- <a href="../../topic/{topics.slug}#{topics.teaser_pid}">- [[category:replied]]- </a>- <span class="timeago" title="{topics.teaser_timestamp}"></span>- <!-- ENDIF topics.unreplied -->- </span>- </small>- </div>- </div>+ [[category:posted]] <span class="timeago" title="{topics.relativeTime}"></span>+ </span>++ <span class="pull-right hidden-xs">+ <!-- IF topics.unreplied -->+ [[category:no_replies]]+ <!-- ELSE -->+ <a href="../../user/{topics.teaser_userslug}">+ <img class="teaser-pic" src="{topics.teaser_userpicture}" title="{topics.teaser_username}"/>+ </a>+ <a href="../../topic/{topics.slug}#{topics.teaser_pid}">+ [[category:replied]]+ </a>+ <span class="timeago" title="{topics.teaser_timestamp}"></span>+ <!-- ENDIF topics.unreplied -->+ </span>+ </small>+</div>+</li><!-- END topics --></ul>diff --git a/public/templates/favourites.tpl b/public/templates/favourites.tplindex c26e4952c1..a8898922cf 100644--- a/public/templates/favourites.tpl+++ b/public/templates/favourites.tpl@@ -13,28 +13,29 @@<div class="row"><div class="col-md-12 user-favourite-posts"><!-- BEGIN posts -->- <div class="topic-row img-thumbnail clearfix">- <a href="../../user/{posts.userslug}">- <img title="{posts.username}" class="img-rounded user-img" src="{posts.picture}">- </a>+ <div class="topic-row panel panel-default clearfix">+ <div class="panel-body">+ <a href="../../user/{posts.userslug}">+ <img title="{posts.username}" class="img-rounded user-img" src="{posts.picture}">+ </a>- <a href="../../user/{posts.userslug}">- <strong><span>{posts.username}</span></strong>- </a>- <p>{posts.content}</p>+ <a href="../../user/{posts.userslug}">+ <strong><span>{posts.username}</span></strong>+ </a>+ <p>{posts.content}</p>- <div>- <span class="pull-right">- <a href="../../topic/{posts.tid}/#{posts.pid}">posted</a>- in- <a href="../../category/{posts.categorySlug}">- <i class="fa {posts.categoryIcon}"></i> {posts.categoryName}- </a>- <span class="timeago" title="{posts.relativeTime}"></span>- </span>+ <div>+ <span class="pull-right">+ <a href="../../topic/{posts.tid}/#{posts.pid}">posted</a>+ in+ <a href="../../category/{posts.categorySlug}">+ <i class="fa {posts.categoryIcon}"></i> {posts.categoryName}+ </a>+ <span class="timeago" title="{posts.relativeTime}"></span>+ </span>+ </div></div></div>- <br/><!-- END posts --></div></div>diff --git a/public/templates/home.tpl b/public/templates/home.tplindex dc690477c4..80c2962d4e 100644--- a/public/templates/home.tpl+++ b/public/templates/home.tpl@@ -1,22 +1,31 @@-<div class="motd{motd_class}">+<div class="panel motd{motd_class}">{motd}</div><div class="row home" itemscope itemtype="http://www.schema.org/ItemList"><!-- BEGIN categories --><div class="{categories.class}">++ <meta itemprop="name" content="{categories.name}">+ <h4>+ <!-- IF !categories.link -->+ <span class="badge {categories.badgeclass}">{categories.topic_count} </span>+ <!-- ENDIF !categories.link -->++ <!-- IF categories.link -->+ <a href="{categories.link}" itemprop="url" target="_blank">+ <!-- ELSE -->+ <a href="{relative_path}/category/{categories.slug}" itemprop="url">+ <!-- ENDIF categories.link -->+ {categories.name}+ </a>+ </h4>+<!-- IF categories.link --><a href="{categories.link}" itemprop="url" target="_blank"><!-- ELSE --><a href="{relative_path}/category/{categories.slug}" itemprop="url"><!-- ENDIF categories.link -->- <meta itemprop="name" content="{categories.name}">- <h4>- <!-- IF !categories.link -->- <span class="badge {categories.badgeclass}">{categories.topic_count} </span>- <!-- ENDIF !categories.link -->- {categories.name}- </h4><div class="icon" style="background: {categories.background}; color: {categories.color};"><div id="category-{categories.cid}" class="category-slider-{categories.post_count}"><div class="category-box"><i class="fa {categories.icon} fa-4x"></i></div>diff --git a/public/templates/recent.tpl b/public/templates/recent.tplindex 3cd0ef667d..f25ecd76f9 100644--- a/public/templates/recent.tpl+++ b/public/templates/recent.tpl@@ -24,50 +24,57 @@<ul id="topics-container"><!-- BEGIN topics --><li class="category-item {topics.deleted-class}">- <div class="row">- <div class="col-md-12 col-xs-12 topic-row img-thumbnail">+ <div class="col-md-12 col-xs-12 panel panel-default topic-row">+ <h3><a href="{relative_path}/topic/{topics.slug}">- <h3><span class="topic-title"><strong><i class="fa {topics.pin-icon}"></i> <i class="fa {topics.lock-icon}"></i></strong> {topics.title}</span></h3>- </a>- <small>- <span class="topic-stats">- posts- <strong class="human-readable-number" title="{topics.postcount}">{topics.postcount}</strong>- </span>- |- <span class="topic-stats">- views- <strong class="human-readable-number" title="{topics.viewcount}">{topics.viewcount}</strong>- </span>- |- <span>- <a href="{relative_path}/user/{topics.userslug}">- <img class="teaser-pic" src="{topics.picture}" title="{topics.username}"/>- </a>- posted in- <a href="{relative_path}/category/{topics.categorySlug}">- <i class="fa {topics.categoryIcon}"></i> {topics.categoryName}- </a>- <span class="timeago" title="{topics.relativeTime}"></span>- </span>+ <span class="topic-title">+ <strong>+ <i class="fa {topics.pin-icon}"></i>+ <i class="fa {topics.lock-icon}"></i>+ </strong>+ {topics.title}</span>+ </a>+ </h3>- <span class="pull-right hidden-xs">- <!-- IF topics.unreplied -->- No one has replied- <!-- ELSE -->- <a href="{relative_path}/user/{topics.teaser_userslug}">- <img class="teaser-pic" src="{topics.teaser_userpicture}" title="{topics.teaser_username}"/>- </a>- <a href="{relative_path}/topic/{topics.slug}#{topics.teaser_pid}">- replied- </a>- <span class="timeago" title="{topics.teaser_timestamp}"></span>- <!-- ENDIF topics.unreplied -->+ <small>+ <span class="topic-stats">+ posts+ <strong class="human-readable-number" title="{topics.postcount}">{topics.postcount}</strong>+ </span>+ |+ <span class="topic-stats">+ views+ <strong class="human-readable-number" title="{topics.viewcount}">{topics.viewcount}</strong>+ </span>+ |+ <span>+ <a href="{relative_path}/user/{topics.userslug}">+ <img class="teaser-pic" src="{topics.picture}" title="{topics.username}"/>+ </a>+ posted in+ <a href="{relative_path}/category/{topics.categorySlug}">+ <i class="fa {topics.categoryIcon}"></i> {topics.categoryName}+ </a>+ <span class="timeago" title="{topics.relativeTime}"></span></span>- </small>- </div>+ </span>++ <span class="pull-right hidden-xs">+ <!-- IF topics.unreplied -->+ No one has replied+ <!-- ELSE -->+ <a href="{relative_path}/user/{topics.teaser_userslug}">+ <img class="teaser-pic" src="{topics.teaser_userpicture}" title="{topics.teaser_username}"/>+ </a>+ <a href="{relative_path}/topic/{topics.slug}#{topics.teaser_pid}">+ replied+ </a>+ <span class="timeago" title="{topics.teaser_timestamp}"></span>+ <!-- ENDIF topics.unreplied -->+ </span>+ </small></div></li><!-- END topics -->diff --git a/public/templates/topic.tpl b/public/templates/topic.tplindex ee93319e11..5485797cc8 100644--- a/public/templates/topic.tpl+++ b/public/templates/topic.tpl@@ -23,7 +23,7 @@<ul id="post-container" class="posts" data-tid="{topic_id}"><!-- BEGIN posts -->- <li class="row post-row infiniteloaded" data-pid="{posts.pid}" data-uid="{posts.uid}" data-username="{posts.username}" data-userslug="{posts.userslug}" data-index="{posts.index}" data-deleted="{posts.deleted}" itemscope itemtype="http://schema.org/Comment">+ <li class="post-row infiniteloaded" data-pid="{posts.pid}" data-uid="{posts.uid}" data-username="{posts.username}" data-userslug="{posts.userslug}" data-index="{posts.index}" data-deleted="{posts.deleted}" itemscope itemtype="http://schema.org/Comment"><a id="post_anchor_{posts.pid}" name="{posts.pid}"></a><meta itemprop="datePublished" content="{posts.relativeTime}">@@ -36,107 +36,106 @@<span class="label label-danger">[[topic:banned]]</span><!-- ENDIF posts.user_banned --></a>-</div>- <div class="col-md-11">- <div class="post-block">- <a class="main-post avatar" href="{relative_path}/user/{posts.userslug}">- <img itemprop="image" src="{posts.picture}" align="left" class="img-thumbnail" width=150 height=150 />- </a>- <h3 class="main-post">- <p id="topic_title_{posts.pid}" class="topic-title" itemprop="name">{topic_name}</p>- </h3>+ <div class="col-md-11 panel panel-default post-block">- <div class="topic-buttons">+ <a class="main-post avatar" href="{relative_path}/user/{posts.userslug}">+ <img itemprop="image" src="{posts.picture}" align="left" class="img-thumbnail" width=150 height=150 />+ </a>+ <h3 class="main-post">+ <p id="topic_title_{posts.pid}" class="topic-title" itemprop="name">{topic_name}</p>+ </h3>- <div class="btn-group">- <button class="btn btn-sm btn-default dropdown-toggle" data-toggle="dropdown" type="button" title="[[topic:posted_by]] {posts.username}">- <img class="visible-xs visible-sm pull-left" src="{posts.picture}" width=18 height=18 />- <span class="username-field" href="{relative_path}/user/{posts.userslug}" itemprop="author"> {posts.username} </span>- <span class="caret"></span>- </button>+ <div class="topic-buttons">- <ul class="dropdown-menu">- <li><a href="{relative_path}/user/{posts.userslug}"><i class="fa fa-user"></i> [[topic:profile]]</a></li>- <li><a href="#" class="chat"><i class="fa fa-comment"></i> [[topic:chat]]</a></li>- </ul>- </div>+ <div class="btn-group">+ <button class="btn btn-sm btn-default dropdown-toggle" data-toggle="dropdown" type="button" title="[[topic:posted_by]] {posts.username}">+ <img class="visible-xs visible-sm pull-left" src="{posts.picture}" width=18 height=18 />+ <span class="username-field" href="{relative_path}/user/{posts.userslug}" itemprop="author"> {posts.username} </span>+ <span class="caret"></span>+ </button>- <div class="btn-group">- <!-- IF @first -->- <button class="btn btn-sm btn-default follow" type="button" title="Be notified of new replies in this topic"><i class="fa fa-eye"></i></button>- <!-- ENDIF @first -->- <button data-favourited="{posts.favourited}" class="favourite btn btn-sm btn-default <!-- IF posts.favourited --> btn-warning <!-- ENDIF posts.favourited -->" type="button">- <span class="favourite-text">[[topic:favourite]]</span>- <span class="post_rep_{posts.pid}">{posts.reputation} </span>- <!-- IF posts.favourited -->- <i class="fa fa-star"></i>- <!-- ELSE -->- <i class="fa fa-star-o"></i>- <!-- ENDIF posts.favourited -->- </button>- </div>- <div class="btn-group">- <button class="btn btn-sm btn-default quote" type="button" title="[[topic:quote]]"><i class="fa fa-quote-left"></i></button>- <button class="btn btn-sm btn-primary btn post_reply" type="button">[[topic:reply]] <i class="fa fa-reply"></i></button>- </div>+ <ul class="dropdown-menu">+ <li><a href="{relative_path}/user/{posts.userslug}"><i class="fa fa-user"></i> [[topic:profile]]</a></li>+ <li><a href="#" class="chat"><i class="fa fa-comment"></i> [[topic:chat]]</a></li>+ </ul>+ </div>- <div class="pull-right">- <div class="btn-group post-tools">- <div class="dropdown share-dropdown">- <button title="[[topic:share]]"class="btn btn-sm btn-default share" data-toggle="dropdown" href="#"><i class="fa fa-share-square-o"></i></button>- <ul class="dropdown-menu text-center pull-right" role="menu" aria-labelledby="dLabel">- <!-- IF !disableSocialButtons -->- <li class="btn btn-sm btn-default facebook-share" type="button" title=""><i class="fa fa-facebook"></i></li>- <li class="btn btn-sm btn-default twitter-share" type="button" title=""><i class="fa fa-twitter"></i></li>- <li class="btn btn-sm btn-default google-share" type="button" title=""><i class="fa fa-google-plus"></i></li>- <!-- ENDIF !disableSocialButtons -->- <li>- <input type="text" id="post_{posts.pid}_link" value="" class="form-control pull-right post-link" style=""></input>- <li>- </ul>- </div>+ <div class="btn-group">+ <!-- IF @first -->+ <button class="btn btn-sm btn-default follow" type="button" title="Be notified of new replies in this topic"><i class="fa fa-eye"></i></button>+ <!-- ENDIF @first -->+ <button data-favourited="{posts.favourited}" class="favourite btn btn-sm btn-default <!-- IF posts.favourited --> btn-warning <!-- ENDIF posts.favourited -->" type="button">+ <span class="favourite-text">[[topic:favourite]]</span>+ <span class="post_rep_{posts.pid}">{posts.reputation} </span>+ <!-- IF posts.favourited -->+ <i class="fa fa-star"></i>+ <!-- ELSE -->+ <i class="fa fa-star-o"></i>+ <!-- ENDIF posts.favourited -->+ </button>+ </div>+ <div class="btn-group">+ <button class="btn btn-sm btn-default quote" type="button" title="[[topic:quote]]"><i class="fa fa-quote-left"></i></button>+ <button class="btn btn-sm btn-primary btn post_reply" type="button">[[topic:reply]] <i class="fa fa-reply"></i></button>+ </div>++ <div class="pull-right">+ <div class="btn-group post-tools">+ <div class="dropdown share-dropdown">+ <button title="[[topic:share]]"class="btn btn-sm btn-default share" data-toggle="dropdown" href="#"><i class="fa fa-share-square-o"></i></button>+ <ul class="dropdown-menu text-center pull-right" role="menu" aria-labelledby="dLabel">+ <!-- IF !disableSocialButtons -->+ <li class="btn btn-sm btn-default facebook-share" type="button" title=""><i class="fa fa-facebook"></i></li>+ <li class="btn btn-sm btn-default twitter-share" type="button" title=""><i class="fa fa-twitter"></i></li>+ <li class="btn btn-sm btn-default google-share" type="button" title=""><i class="fa fa-google-plus"></i></li>+ <!-- ENDIF !disableSocialButtons -->+ <li>+ <input type="text" id="post_{posts.pid}_link" value="" class="form-control pull-right post-link" style=""></input>+ <li>+ </ul></div>+ </div>- <!-- IF posts.display_moderator_tools -->- <div class="btn-group post-tools">- <div class="dropdown">- <button title="[[topic:tools]]" class="btn btn-sm btn-default" data-toggle="dropdown" href="#"><i class="fa fa-gear"></i></button>- <ul class="dropdown-menu text-center pull-right" role="menu" aria-labelledby="dLabel">- <button class="btn btn-sm btn-default edit" type="button" title="[[topic:edit]]"><i class="fa fa-pencil"></i></button>- <button class="btn btn-sm btn-default delete" type="button" title="[[topic:delete]]"><i class="fa fa-trash-o"></i></button>+ <!-- IF posts.display_moderator_tools -->+ <div class="btn-group post-tools">+ <div class="dropdown">+ <button title="[[topic:tools]]" class="btn btn-sm btn-default" data-toggle="dropdown" href="#"><i class="fa fa-gear"></i></button>+ <ul class="dropdown-menu text-center pull-right" role="menu" aria-labelledby="dLabel">+ <button class="btn btn-sm btn-default edit" type="button" title="[[topic:edit]]"><i class="fa fa-pencil"></i></button>+ <button class="btn btn-sm btn-default delete" type="button" title="[[topic:delete]]"><i class="fa fa-trash-o"></i></button>- <button class="btn btn-sm btn-default move {posts.display_move_tools}" type="button" title="[[topic:move]]"><i class="fa fa-arrows"></i></button>+ <button class="btn btn-sm btn-default move {posts.display_move_tools}" type="button" title="[[topic:move]]"><i class="fa fa-arrows"></i></button>- </ul>- </div>+ </ul></div>- <!-- ENDIF posts.display_moderator_tools --></div>+ <!-- ENDIF posts.display_moderator_tools --></div>+ </div>- <div id="content_{posts.pid}" class="post-content" itemprop="text">{posts.content}</div>- <!-- IF posts.signature -->- <div class="post-signature">{posts.signature}</div>- <!-- ENDIF posts.signature -->+ <div id="content_{posts.pid}" class="post-content" itemprop="text">{posts.content}</div>+ <!-- IF posts.signature -->+ <div class="post-signature">{posts.signature}</div>+ <!-- ENDIF posts.signature -->- <div class="post-info">- <span class="pull-left">- [[topic:reputation]]: <i class='fa fa-star'></i> <span class='formatted-number post_rep_{posts.uid}'>{posts.user_rep}</span> | [[topic:posts]]: <i class='fa fa-pencil'></i> <span class='formatted-number user_postcount_{posts.uid}'>{posts.user_postcount}</span>- {posts.additional_profile_info}- </span>- <span class="pull-right">- [[category:posted]] <span class="relativeTimeAgo timeago" title="{posts.relativeTime}"></span>- <!-- IF posts.editor -->- <span>| [[category:last_edited_by]] <strong><a href="{relative_path}/user/{posts.editorslug}">{posts.editorname}</a></strong></span>- <span class="timeago" title="{posts.relativeEditTime}"></span>- <!-- ENDIF posts.editor -->- </span>- <div style="clear:both;"></div>- </div>+ <div class="post-info">+ <span class="pull-left">+ [[topic:reputation]]: <i class='fa fa-star'></i> <span class='formatted-number post_rep_{posts.uid}'>{posts.user_rep}</span> | [[topic:posts]]: <i class='fa fa-pencil'></i> <span class='formatted-number user_postcount_{posts.uid}'>{posts.user_postcount}</span>+ {posts.additional_profile_info}+ </span>+ <span class="pull-right">+ [[category:posted]] <span class="relativeTimeAgo timeago" title="{posts.relativeTime}"></span>+ <!-- IF posts.editor -->+ <span>| [[category:last_edited_by]] <strong><a href="{relative_path}/user/{posts.editorslug}">{posts.editorname}</a></strong></span>+ <span class="timeago" title="{posts.relativeEditTime}"></span>+ <!-- ENDIF posts.editor -->+ </span>+ <div style="clear:both;"></div></div></div>+ <div style="clear:both;"></div></li><!-- IF @first -->diff --git a/public/templates/unread.tpl b/public/templates/unread.tplindex 142945b20e..55c590e251 100644--- a/public/templates/unread.tpl+++ b/public/templates/unread.tpl@@ -19,49 +19,57 @@<ul id="topics-container" data-next-start="{nextStart}"><!-- BEGIN topics --><li class="category-item {topics.deleted-class}">- <div class="row">- <div class="col-md-12 topic-row">+ <div class="col-md-12 col-xs-12 panel panel-default topic-row">++ <h3><a href="{relative_path}/topic/{topics.slug}">- <h3><span class="topic-title"><strong><i class="fa {topics.pin-icon}"></i> <i class="fa {topics.lock-icon}"></i></strong> {topics.title}</span></h3>- </a>- <small>- <span class="topic-stats">- posts- <strong class="human-readable-number" title="{topics.postcount}">{topics.postcount}</strong>- </span>- |- <span class="topic-stats">- views- <strong class="human-readable-number" title="{topics.viewcount}">{topics.viewcount}</strong>- </span>- |- <span>- <a href="{relative_path}/user/{topics.userslug}">- <img class="teaser-pic" src="{topics.picture}" title="{topics.username}"/>- </a>- posted in- <a href="{relative_path}/category/{topics.categorySlug}">- <i class="fa {topics.categoryIcon}"></i> {topics.categoryName}- </a>- <span class="timeago" title="{topics.relativeTime}"></span>- </span>+ <span class="topic-title">+ <strong>+ <i class="fa {topics.pin-icon}"></i>+ <i class="fa {topics.lock-icon}"></i>+ </strong>+ {topics.title}</span>+ </a>+ </h3>- <span class="pull-right hidden-xs">- <!-- IF topics.unreplied -->- No one has replied- <!-- ELSE -->- <a href="{relative_path}/user/{topics.teaser_userslug}">- <img class="teaser-pic" src="{topics.teaser_userpicture}" title="{topics.teaser_username}"/>- </a>- <a href="{relative_path}/topic/{topics.slug}#{topics.teaser_pid}">- replied- </a>- <span class="timeago" title="{topics.teaser_timestamp}"></span>- <!-- ENDIF topics.unreplied -->+ <small>+ <span class="topic-stats">+ posts+ <strong class="human-readable-number" title="{topics.postcount}">{topics.postcount}</strong>+ </span>+ |+ <span class="topic-stats">+ views+ <strong class="human-readable-number" title="{topics.viewcount}">{topics.viewcount}</strong>+ </span>+ |+ <span>+ <a href="{relative_path}/user/{topics.userslug}">+ <img class="teaser-pic" src="{topics.picture}" title="{topics.username}"/>+ </a>+ posted in+ <a href="{relative_path}/category/{topics.categorySlug}">+ <i class="fa {topics.categoryIcon}"></i> {topics.categoryName}+ </a>+ <span class="timeago" title="{topics.relativeTime}"></span></span>- </small>- </div>+ </span>++ <span class="pull-right hidden-xs">+ <!-- IF topics.unreplied -->+ No one has replied+ <!-- ELSE -->+ <a href="{relative_path}/user/{topics.teaser_userslug}">+ <img class="teaser-pic" src="{topics.teaser_userpicture}" title="{topics.teaser_username}"/>+ </a>+ <a href="{relative_path}/topic/{topics.slug}#{topics.teaser_pid}">+ replied+ </a>+ <span class="timeago" title="{topics.teaser_timestamp}"></span>+ <!-- ENDIF topics.unreplied -->+ </span>+ </small></div></li><!-- END topics -->diff --git a/src/posts.js b/src/posts.jsindex 405865bca4..2be8c7b83b 100644--- a/src/posts.js+++ b/src/posts.js@@ -126,6 +126,60 @@ var db = require('./database'),});};+ Posts.getPostsByPids = function(pids, callback) {+ var keys = [];++ for(var x=0, numPids=pids.length; x<numPids; ++x) {+ keys.push('post:' + pids[x]);+ }++ db.getObjects(keys, function(err, data) {+ if(err) {+ return callback(err);+ }++ async.map(data, function(postData, next) {+ if(!postData) {+ return next(null);+ }++ postData.relativeTime = utils.toISOString(postData.timestamp);+ postData.relativeEditTime = parseInt(postData.edited, 10) !== 0 ? utils.toISOString(postData.edited) : '';++ postTools.parse(postData.content, function(err, content) {+ if(err) {+ return next(err);+ }++ postData.content = content;+ next(null, postData);+ });++ }, callback);+ });+ };++ Posts.getPostsByUid = function(callerUid, uid, start, end, callback) {+ user.getPostIds(uid, start, end, function(err, pids) {+ if(err) {+ return callback(err);+ }++ async.filter(pids, function(pid, next) {+ postTools.privileges(pid, callerUid, function(err, privileges) {+ next(privileges.read);+ });+ }, function(pids) {+ if (!(pids && pids.length)) {+ return callback(null, []);+ }+++ Posts.getPostSummaryByPids(pids, false, callback);+ });+ });+ }+Posts.addUserInfoToPost = function(post, callback) {user.getUserFields(post.uid, ['username', 'userslug', 'reputation', 'postcount', 'picture', 'signature', 'banned'], function(err, userData) {if (err) {@@ -310,39 +364,6 @@ var db = require('./database'),db.setObject('post:' + pid, data, callback);};- Posts.getPostsByPids = function(pids, callback) {- var keys = [];-- for(var x=0, numPids=pids.length; x<numPids; x++) {- keys.push('post:' + pids[x]);- }-- db.getObjects(keys, function(err, data) {- if(err) {- return callback(err);- }-- async.map(data, function(postData, next) {- if(!postData) {- return next(null);- }-- postData.relativeTime = utils.toISOString(postData.timestamp);- postData.relativeEditTime = parseInt(postData.edited, 10) !== 0 ? utils.toISOString(postData.edited) : '';-- postTools.parse(postData.content, function(err, content) {- if(err) {- return next(err);- }-- postData.content = content;- next(null, postData);- });-- }, callback);- });- }-Posts.getCidByPid = function(pid, callback) {Posts.getPostField(pid, 'tid', function(err, tid) {if(err) {@@ -418,40 +439,6 @@ var db = require('./database'),});}- Posts.getPostsByUid = function(uid, start, end, callback) {- user.getPostIds(uid, start, end, function(err, pids) {- if(err) {- return callback(err);- }-- async.filter(pids, function(pid, next) {- postTools.privileges(pid, 0, function(err, privileges) {- next(privileges.read);- });- }, function(pids) {- if (pids && pids.length) {- plugins.fireHook('filter:post.getTopic', pids, function(err, posts) {- if(err) {- return callback(err);- }-- if (posts && posts.length) {- Posts.getPostsByPids(pids, function(err, posts) {- plugins.fireHook('action:post.gotTopic', posts);- callback(null, posts);- });- } else {- callback(null, []);- }- });- } else {- callback(null, []);- }- });- });- }--Posts.reIndexPids = function(pids, callback) {function reIndex(pid, callback) {@@ -478,16 +465,11 @@ var db = require('./database'),Posts.getFavourites = function(uid, callback) {db.getSortedSetRevRange('uid:' + uid + ':favourites', 0, -1, function(err, pids) {- if (err)+ if (err) {return callback(err, null);+ }- Posts.getPostSummaryByPids(pids, false, function(err, posts) {- if (err)- return callback(err, null);-- callback(null, posts);- });-+ Posts.getPostSummaryByPids(pids, false, callback);});}diff --git a/src/routes/user.js b/src/routes/user.jsindex 40bd5713c2..48dc5c26d0 100644--- a/src/routes/user.js+++ b/src/routes/user.js@@ -407,38 +407,41 @@ var fs = require('fs'),var callerUID = req.user ? req.user.uid : '0';getUserDataByUserSlug(req.params.userslug, callerUID, function (userData) {- if (userData) {- user.isFollowing(callerUID, userData.theirid, function (isFollowing) {- posts.getPostsByUid(userData.theirid, 0, 9, function (err, posts) {+ if(!userData) {+ return res.json(404, {+ error: 'User not found!'+ });+ }- if(err) {- return next(err);- }+ user.isFollowing(callerUID, userData.theirid, function (isFollowing) {- userData.posts = posts.filter(function (p) {- return p && parseInt(p.deleted, 10) !== 1;- });+ posts.getPostsByUid(callerUID, userData.theirid, 0, 9, function (err, posts) {- userData.isFollowing = isFollowing;+ if(err) {+ return next(err);+ }- if (!userData.profileviews) {- userData.profileviews = 1;- }- if (parseInt(callerUID, 10) !== parseInt(userData.uid, 10)) {- user.incrementUserFieldBy(userData.uid, 'profileviews', 1);- }+ userData.posts = posts.filter(function (p) {+ return p && parseInt(p.deleted, 10) !== 1;+ });- postTools.parse(userData.signature, function (err, signature) {- userData.signature = signature;- res.json(userData);- });+ userData.isFollowing = isFollowing;++ if (!userData.profileviews) {+ userData.profileviews = 1;+ }++ if (parseInt(callerUID, 10) !== parseInt(userData.uid, 10)) {+ user.incrementUserFieldBy(userData.uid, 'profileviews', 1);+ }++ postTools.parse(userData.signature, function (err, signature) {+ userData.signature = signature;+ res.json(userData);});});- } else {- res.json(404, {- error: 'User not found!'- });- }+ });+});});