mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-02 20:16:04 +01:00
don't mark all chats as read when just reading the list from dropdown/slidemenu/chats page
strangely enough it was doing it twice
This commit is contained in:
@@ -111,7 +111,8 @@ var db = require('./database'),
|
|||||||
touid = params.touid,
|
touid = params.touid,
|
||||||
since = params.since,
|
since = params.since,
|
||||||
isNew = params.isNew,
|
isNew = params.isNew,
|
||||||
count = params.count || parseInt(meta.config.chatMessageInboxSize, 10) || 250;
|
count = params.count || parseInt(meta.config.chatMessageInboxSize, 10) || 250,
|
||||||
|
markRead = params.markRead || true;
|
||||||
|
|
||||||
var uids = sortUids(fromuid, touid),
|
var uids = sortUids(fromuid, touid),
|
||||||
min = params.count ? 0 : Date.now() - (terms[since] || terms.day);
|
min = params.count ? 0 : Date.now() - (terms[since] || terms.day);
|
||||||
@@ -135,6 +136,7 @@ var db = require('./database'),
|
|||||||
getMessages(mids, fromuid, touid, isNew, callback);
|
getMessages(mids, fromuid, touid, isNew, callback);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (markRead) {
|
||||||
notifications.markRead('chat_' + touid + '_' + fromuid, fromuid, function(err) {
|
notifications.markRead('chat_' + touid + '_' + fromuid, fromuid, function(err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
winston.error('[messaging] Could not mark notifications related to this chat as read: ' + err.message);
|
winston.error('[messaging] Could not mark notifications related to this chat as read: ' + err.message);
|
||||||
@@ -142,6 +144,7 @@ var db = require('./database'),
|
|||||||
|
|
||||||
userNotifications.pushCount(fromuid);
|
userNotifications.pushCount(fromuid);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
function getMessages(mids, fromuid, touid, isNew, callback) {
|
function getMessages(mids, fromuid, touid, isNew, callback) {
|
||||||
@@ -271,7 +274,8 @@ var db = require('./database'),
|
|||||||
fromuid: fromuid,
|
fromuid: fromuid,
|
||||||
touid: uid,
|
touid: uid,
|
||||||
isNew: false,
|
isNew: false,
|
||||||
count: 1
|
count: 1,
|
||||||
|
markRead: false
|
||||||
}, function(err, teaser) {
|
}, function(err, teaser) {
|
||||||
var teaser = teaser[0];
|
var teaser = teaser[0];
|
||||||
teaser.content = S(teaser.content).stripTags().decodeHTMLEntities().s;
|
teaser.content = S(teaser.content).stripTags().decodeHTMLEntities().s;
|
||||||
@@ -286,7 +290,6 @@ var db = require('./database'),
|
|||||||
|
|
||||||
results.users.forEach(function(user, index) {
|
results.users.forEach(function(user, index) {
|
||||||
if (user && parseInt(user.uid, 10)) {
|
if (user && parseInt(user.uid, 10)) {
|
||||||
Messaging.markRead(uid, uids[index]);
|
|
||||||
user.unread = results.unread[index];
|
user.unread = results.unread[index];
|
||||||
user.status = sockets.isUserOnline(user.uid) ? user.status : 'offline';
|
user.status = sockets.isUserOnline(user.uid) ? user.status : 'offline';
|
||||||
user.teaser = results.teasers[index];
|
user.teaser = results.teasers[index];
|
||||||
|
|||||||
Reference in New Issue
Block a user