Avatars cache: don't consider updatedTimestamp field
The updatedTimestamp field doesn't reflect when the thread was last
modified (sometimes a new reply is added and the timestamp doesn't
change), so this change stops adding it to the cache and considering
only the lastMessageId field in order to determine whether a cache entry
is still valid or not.
Bug: twpowertools:11
Change-Id: I64dd8b8fc25b431bb5294f6aa59b014f1084d758
diff --git a/src/contentScripts/communityConsole/avatars.js b/src/contentScripts/communityConsole/avatars.js
index 5e5eeee..ddc6e3c 100644
--- a/src/contentScripts/communityConsole/avatars.js
+++ b/src/contentScripts/communityConsole/avatars.js
@@ -125,7 +125,6 @@
// The following fields are useful for the cache and can be
// undefined, but this is checked before adding an entry to the
// cache.
- updatedTimestamp: data?.['1']?.['2']?.['1']?.['4'],
lastMessageId: data?.['1']?.['2']?.['10'],
};
});
@@ -136,8 +135,6 @@
return this.getFirstMessages(thread).then(result => {
var messages = result.messages;
var author = result.author;
- var updatedTimestamp =
- Math.floor(Number.parseInt(result.updatedTimestamp) / 1000000);
var lastMessageId = result.lastMessageId;
var avatarUrls = [];
@@ -154,10 +151,9 @@
}
// Add entry to cache if all the extra metadata could be retrieved.
- if (updatedTimestamp !== undefined && lastMessageId !== undefined)
+ if (lastMessageId !== undefined)
this.db.putCacheEntry({
threadId: thread.thread,
- updatedTimestamp,
lastMessageId,
avatarUrls,
num,