unread changes

v1.18.x
Baris Soner Usakli 11 years ago
parent 85d4bc7232
commit d27ba5239e

@ -33,7 +33,7 @@
<ul id="topics-container" itemscope itemtype="http://www.schema.org/ItemList" data-nextstart="{nextStart}">
<meta itemprop="itemListOrder" content="descending">
<!-- BEGIN topics -->
<li class="category-item {topics.deleted-class}" itemprop="itemListElement">
<li class="category-item {topics.deleted-class} {topics.unread-class}" itemprop="itemListElement">
<div class="col-md-12 col-xs-12 panel panel-default topic-row">
<a href="../../user/{topics.userslug}" class="pull-left">

@ -24,7 +24,7 @@
<div class="col-md-12">
<ul id="topics-container" data-nextstart="{nextStart}">
<!-- BEGIN topics -->
<li class="category-item {topics.deleted-class}">
<li class="category-item {topics.deleted-class} {topics.unread-class}">
<div class="col-md-12 col-xs-12 panel panel-default topic-row">
<a href="{relative_path}/user/{topics.userslug}" class="pull-left">
<img class="img-rounded user-img" src="{topics.picture}" title="{topics.username}" />

@ -25,7 +25,7 @@
<div class="col-md-12">
<ul id="topics-container" data-nextstart="{nextStart}">
<!-- BEGIN topics -->
<li class="category-item {topics.deleted-class}">
<li class="category-item {topics.deleted-class} {topics.unread-class}">
<div class="col-md-12 col-xs-12 panel panel-default topic-row">
<a href="{relative_path}/user/{topics.userslug}" class="pull-left">
<img class="img-rounded user-img" src="{topics.picture}" title="{topics.username}" />

@ -751,7 +751,9 @@ var async = require('async'),
topicData['pin-icon'] = parseInt(topicData.pinned, 10) === 1 ? 'fa-thumb-tack' : 'none';
topicData['lock-icon'] = parseInt(topicData.locked, 10) === 1 ? 'fa-lock' : 'none';
topicData['deleted-class'] = parseInt(topicData.deleted, 10) === 1 ? 'deleted' : '';
topicData['unread-class'] = !(topicInfo.hasread && parseInt(current_user, 10) !== 0) ? 'unread' : '';
topicData.unread = !(topicInfo.hasread && parseInt(current_user, 10) !== 0);
topicData.unreplied = parseInt(topicData.postcount, 10) === 1;
topicData.username = topicInfo.username || 'anonymous';
topicData.userslug = topicInfo.userslug || '';
@ -759,7 +761,7 @@ var async = require('async'),
topicData.categoryIcon = topicInfo.categoryData.icon;
topicData.categoryName = topicInfo.categoryData.name;
topicData.categorySlug = topicInfo.categoryData.slug;
topicData.badgeclass = (topicInfo.hasread && parseInt(current_user, 10) !== 0) ? '' : 'badge-important';
topicData.teaser_username = topicInfo.teaserInfo.username || '';
topicData.teaser_userslug = topicInfo.teaserInfo.userslug || '';
topicData.teaser_userpicture = topicInfo.teaserInfo.picture || gravatar.url('', {}, true);
@ -884,8 +886,9 @@ var async = require('async'),
topicData['pin-icon'] = parseInt(topicData.pinned, 10) === 1 ? 'fa-thumb-tack' : 'none';
topicData['lock-icon'] = parseInt(topicData.locked, 10) === 1 ? 'fa-lock' : 'none';
topicData['unread-class'] = !(topicInfo.hasread && parseInt(current_user, 10) !== 0) ? 'unread' : '';
topicData.badgeclass = hasRead ? '' : 'badge-important';
topicData.unread = !(topicInfo.hasread && parseInt(current_user, 10) !== 0);
topicData.teaser_username = teaser.username || '';
topicData.teaser_userslug = teaser.userslug || '';
topicData.userslug = teaser.userslug || '';
@ -1007,6 +1010,12 @@ var async = require('async'),
}
Topics.hasReadTopics = function(tids, uid, callback) {
if(!parseInt(uid, 10)) {
return callback(tids.map(function() {
return false;
}));
}
var sets = [];
for (var i = 0, ii = tids.length; i < ii; i++) {
@ -1019,6 +1028,10 @@ var async = require('async'),
}
Topics.hasReadTopic = function(tid, uid, callback) {
if(!parseInt(uid, 10)) {
return callback(false);
}
db.isSetMember('tid:' + tid + ':read_by_uid', uid, function(err, hasRead) {
if (err === null) {

Loading…
Cancel
Save