Fix addressed to WFC count
This commit is contained in:
parent
127d09a09b
commit
cc20ffc85f
|
@ -519,8 +519,13 @@ function filterMessageListByReadACS(client, messageList) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function getNewMessageCountInAreaForUser(userId, areaTag, cb) {
|
function getNewMessageCountInAreaForUser(
|
||||||
getMessageAreaLastReadId(userId, areaTag, (err, lastMessageId) => {
|
user,
|
||||||
|
areaTag,
|
||||||
|
options = { addrToOnly: false },
|
||||||
|
cb
|
||||||
|
) {
|
||||||
|
getMessageAreaLastReadId(user.userId, areaTag, (err, lastMessageId) => {
|
||||||
lastMessageId = lastMessageId || 0;
|
lastMessageId = lastMessageId || 0;
|
||||||
|
|
||||||
const filter = {
|
const filter = {
|
||||||
|
@ -530,7 +535,9 @@ function getNewMessageCountInAreaForUser(userId, areaTag, cb) {
|
||||||
};
|
};
|
||||||
|
|
||||||
if (Message.isPrivateAreaTag(areaTag)) {
|
if (Message.isPrivateAreaTag(areaTag)) {
|
||||||
filter.privateTagUserId = userId;
|
filter.privateTagUserId = user.userId;
|
||||||
|
} else if (options.addrToOnly) {
|
||||||
|
filter.toUserName = user.username;
|
||||||
}
|
}
|
||||||
|
|
||||||
Message.findMessages(filter, (err, count) => {
|
Message.findMessages(filter, (err, count) => {
|
||||||
|
@ -554,8 +561,9 @@ function getNewMessageCountAddressedToUser(client, cb) {
|
||||||
getMessageAreaLastReadId(client.user.userId, areaTag, (_, lastMessageId) => {
|
getMessageAreaLastReadId(client.user.userId, areaTag, (_, lastMessageId) => {
|
||||||
lastMessageId = lastMessageId || 0; // eslint-disable-line no-unused-vars
|
lastMessageId = lastMessageId || 0; // eslint-disable-line no-unused-vars
|
||||||
getNewMessageCountInAreaForUser(
|
getNewMessageCountInAreaForUser(
|
||||||
client.user.userId,
|
client.user,
|
||||||
areaTag,
|
areaTag,
|
||||||
|
{ addrToOnly: true },
|
||||||
(err, count) => {
|
(err, count) => {
|
||||||
newMessageCount += count;
|
newMessageCount += count;
|
||||||
return nextAreaTag(err);
|
return nextAreaTag(err);
|
||||||
|
|
|
@ -157,8 +157,9 @@ exports.getModule = class NewScanModule extends MenuModule {
|
||||||
},
|
},
|
||||||
function getNewMessagesCountInArea(callback) {
|
function getNewMessagesCountInArea(callback) {
|
||||||
msgArea.getNewMessageCountInAreaForUser(
|
msgArea.getNewMessageCountInAreaForUser(
|
||||||
self.client.user.userId,
|
self.client.user,
|
||||||
currentArea.areaTag,
|
currentArea.areaTag,
|
||||||
|
{ addrToOnly: false },
|
||||||
(err, newMessageCount) => {
|
(err, newMessageCount) => {
|
||||||
callback(err, newMessageCount);
|
callback(err, newMessageCount);
|
||||||
}
|
}
|
||||||
|
|
|
@ -461,8 +461,9 @@ class StatLog {
|
||||||
_refreshUserPrivateMailCount(client) {
|
_refreshUserPrivateMailCount(client) {
|
||||||
const MsgArea = require('./message_area');
|
const MsgArea = require('./message_area');
|
||||||
MsgArea.getNewMessageCountInAreaForUser(
|
MsgArea.getNewMessageCountInAreaForUser(
|
||||||
client.user.userId,
|
client.user,
|
||||||
Message.WellKnownAreaTags.Private,
|
Message.WellKnownAreaTags.Private,
|
||||||
|
{ addrToOnly: false },
|
||||||
(err, count) => {
|
(err, count) => {
|
||||||
if (!err) {
|
if (!err) {
|
||||||
client.user.setProperty(UserProps.NewPrivateMailCount, count);
|
client.user.setProperty(UserProps.NewPrivateMailCount, count);
|
||||||
|
|
Loading…
Reference in New Issue