Invalidate threads when lastMessageId is not set
Some threads don't have the lastMessageId field set when retrieved via
ViewForum, and this caused them to never be invalidated. This change
fixes this, so these threads are always invalidated because we can't
make sure they continue to be valid.
Fixed: twpowertools:13
Change-Id: I39f021645035067807a30d64587acc28f4e876dd
diff --git a/src/contentScripts/communityConsole/utils/AvatarsDB.js b/src/contentScripts/communityConsole/utils/AvatarsDB.js
index ba32fea..191940f 100644
--- a/src/contentScripts/communityConsole/utils/AvatarsDB.js
+++ b/src/contentScripts/communityConsole/utils/AvatarsDB.js
@@ -92,13 +92,14 @@
var id = t?.['2']?.['1']?.['1'];
var currentLastMessageId = t?.['2']?.['10'];
- if (id === undefined || currentLastMessageId === undefined) return;
+ if (id === undefined) return;
promises.push(this.getCacheEntry(id).then(entry => {
if (entry === undefined) return;
// If the cache entry is still valid.
- if (currentLastMessageId == entry.lastMessageId) {
+ if (currentLastMessageId !== undefined &&
+ currentLastMessageId == entry.lastMessageId) {
entry.lastUsedTimestamp = Math.floor(Date.now() / 1000);
return this.putCacheEntry(entry).catch(err => {
console.error(