From ef4453b77bd841d1ac39ae5b1899f20afccd6331 Mon Sep 17 00:00:00 2001 From: Deon George Date: Fri, 16 Dec 2022 23:23:28 +1100 Subject: [PATCH] Fix for when a user only has 1 new message to them --- load/frame-page.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/load/frame-page.js b/load/frame-page.js index 239289f..ab2f615 100644 --- a/load/frame-page.js +++ b/load/frame-page.js @@ -244,28 +244,29 @@ PageFrame.prototype.loadMessage = function(page) { // if this message is to the user, and the msg number > scan_ptr and it is the next message on the user's new mail list var newmsgs = area.newMsgsToMe(); var next; - log(LOG_DEBUG,'User has: '+newmsgs.length+' msgs to read to ME'); + log(LOG_DEBUG,'User has: '+newmsgs.length-1+' msgs to read to ME'); if (newmsgs.length) { next = newmsgs[1]; - log(LOG_DEBUG,'- NEXT is: '+next.tags+', this is: '+msg.tags); + //log(LOG_DEBUG,'- NEXT is: '+next.tags+', this is: '+msg.tags); - if (next.tags === msg.tags) { + if (next && (next.tags === msg.tags)) { log(LOG_DEBUG,'- Updating scan_ptr to: '+next.number); stats.scan_ptr = next.number; } // Last message next = newmsgs[0]; - log(LOG_DEBUG,'- LAST TO ME is: '+next.tags); if (next !== undefined) { + log(LOG_DEBUG,'- LAST TO ME is: '+next.tags); this.key[1] = area.page(next.tags); } // Next new message next = newmsgs[2]; - log(LOG_DEBUG,'- NEXT TO ME is: '+next.tags); - if (next !== undefined) + if (next !== undefined) { + log(LOG_DEBUG,'- NEXT TO ME is: '+next.tags); this.key[2] = area.page(next.tags); + } } // if this message is the next message, update last_read