Update message list after marking all as read for 'newIndicator'

This commit is contained in:
Bryan Ashby 2018-07-07 20:13:24 -06:00
parent dd7b234a1d
commit bf11fc24a3
1 changed files with 10 additions and 0 deletions

View File

@ -324,6 +324,7 @@ exports.getModule = class MessageListModule extends MessageAreaConfTempSwitcher(
} }
}); });
const regIndicator = ' '.repeat( (this.menuConfig.config.newIndicator || '*').length );
async.forEachOf(areaHighestIds, (highestId, areaTag, nextArea) => { async.forEachOf(areaHighestIds, (highestId, areaTag, nextArea) => {
messageArea.updateMessageAreaLastReadId( messageArea.updateMessageAreaLastReadId(
this.client.user.userId, this.client.user.userId,
@ -333,6 +334,15 @@ exports.getModule = class MessageListModule extends MessageAreaConfTempSwitcher(
if(err) { if(err) {
this.client.log.warn( { error : err.message }, 'Failed marking area as read'); this.client.log.warn( { error : err.message }, 'Failed marking area as read');
} else { } else {
// update newIndicator on messages
this.config.messageList.forEach(msg => {
if(areaTag === msg.areaTag) {
msg.newIndicator = regIndicator;
}
});
const msgListView = this.viewControllers.allViews.getView(MciViewIds.allViews.msgList);
msgListView.setItems(this.config.messageList);
msgListView.redraw();
this.client.log.info( { highestId, areaTag }, 'User marked area as read'); this.client.log.info( { highestId, areaTag }, 'User marked area as read');
} }
return nextArea(null); // always continue return nextArea(null); // always continue