mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-11-03 20:45:58 +01:00 
			
		
		
		
	more unread changes
This commit is contained in:
		@@ -114,10 +114,12 @@ define(['composer', 'forum/pagination'], function(composer, pagination) {
 | 
			
		||||
				});
 | 
			
		||||
 | 
			
		||||
				$('.markAsUnreadForAll').on('click', function() {
 | 
			
		||||
					var btn = $(this);
 | 
			
		||||
					socket.emit('topics.markAsUnreadForAll', tid, function(err) {
 | 
			
		||||
						if(err) {
 | 
			
		||||
							return app.alertError(err.message);
 | 
			
		||||
						}
 | 
			
		||||
						btn.parents('.thread-tools.open').find('.dropdown-toggle').trigger('click');
 | 
			
		||||
					});
 | 
			
		||||
					return false;
 | 
			
		||||
				})
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,7 @@
 | 
			
		||||
		<meta itemprop="name" content="{categories.name}">
 | 
			
		||||
		<h4>
 | 
			
		||||
			<!-- IF !categories.link -->
 | 
			
		||||
			<span class="badge {categories.badgeclass}">{categories.topic_count} </span>
 | 
			
		||||
			<span class="badge {categories.unread-class}">{categories.topic_count} </span>
 | 
			
		||||
			<!-- ENDIF !categories.link -->
 | 
			
		||||
 | 
			
		||||
			<!-- IF categories.link -->
 | 
			
		||||
 
 | 
			
		||||
@@ -334,7 +334,8 @@ var db = require('./database'),
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				Categories.hasReadCategory(cid, uid, function(hasRead) {
 | 
			
		||||
					categoryData.badgeclass = (parseInt(categoryData.topic_count, 10) === 0 || (hasRead && uid !== 0)) ? '' : 'badge-important';
 | 
			
		||||
 | 
			
		||||
					categoryData['unread-class'] = (parseInt(categoryData.topic_count, 10) === 0 || (hasRead && parseInt(uid, 10) !== 0)) ? '' : 'unread';
 | 
			
		||||
 | 
			
		||||
					callback(null, categoryData);
 | 
			
		||||
				});
 | 
			
		||||
 
 | 
			
		||||
@@ -152,12 +152,12 @@ var async = require('async'),
 | 
			
		||||
				posts.create(uid, tid, content, next);
 | 
			
		||||
			},
 | 
			
		||||
			function(postData, next) {
 | 
			
		||||
 | 
			
		||||
				threadTools.notifyFollowers(tid, postData.pid, uid);
 | 
			
		||||
 | 
			
		||||
				user.sendPostNotificationToFollowers(uid, tid, postData.pid);
 | 
			
		||||
 | 
			
		||||
				Topics.markCategoryUnreadForAll(tid, function(err) {
 | 
			
		||||
				next(err, postData);
 | 
			
		||||
				});
 | 
			
		||||
			},
 | 
			
		||||
			function(postData, next) {
 | 
			
		||||
				Topics.markAsUnreadForAll(tid, function(err) {
 | 
			
		||||
@@ -972,7 +972,12 @@ var async = require('async'),
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	Topics.markAsUnreadForAll = function(tid, callback) {
 | 
			
		||||
		db.delete('tid:' + tid + ':read_by_uid', callback);
 | 
			
		||||
		db.delete('tid:' + tid + ':read_by_uid', function(err) {
 | 
			
		||||
			if(err) {
 | 
			
		||||
				return callback(err);
 | 
			
		||||
			}
 | 
			
		||||
			Topics.markCategoryUnreadForAll(tid, callback)
 | 
			
		||||
		});
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	Topics.markAsRead = function(tid, uid, callback) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user