Add lastDate property to Chat interface and update chat lastDate on preload
This commit is contained in:
@@ -164,7 +164,7 @@ export async function makeColdData(){
|
|||||||
for(let j=0;j<DBState.db.characters[i].chats.length;j++){
|
for(let j=0;j<DBState.db.characters[i].chats.length;j++){
|
||||||
|
|
||||||
const chat = DBState.db.characters[i].chats[j]
|
const chat = DBState.db.characters[i].chats[j]
|
||||||
let greatestTime = 0
|
let greatestTime = chat.lastDate ?? 0
|
||||||
|
|
||||||
if(chat.message.length < 4){
|
if(chat.message.length < 4){
|
||||||
//it is inefficient to store small data
|
//it is inefficient to store small data
|
||||||
@@ -215,6 +215,7 @@ export async function preLoadChat(characterIndex:number, chatIndex:number){
|
|||||||
const coldData = await getColdStorageItem(coldDataKey)
|
const coldData = await getColdStorageItem(coldDataKey)
|
||||||
if(coldData){
|
if(coldData){
|
||||||
chat.message = coldData
|
chat.message = coldData
|
||||||
|
chat.lastDate = Date.now()
|
||||||
}
|
}
|
||||||
await setColdStorageItem(coldDataKey + '_accessMeta', {
|
await setColdStorageItem(coldDataKey + '_accessMeta', {
|
||||||
lastAccess: Date.now()
|
lastAccess: Date.now()
|
||||||
|
|||||||
@@ -1332,6 +1332,7 @@ export interface Chat{
|
|||||||
fmIndex?:number
|
fmIndex?:number
|
||||||
hypaV3Data?:SerializableHypaV3Data
|
hypaV3Data?:SerializableHypaV3Data
|
||||||
folderId?:string
|
folderId?:string
|
||||||
|
lastDate?:number
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ChatFolder{
|
export interface ChatFolder{
|
||||||
|
|||||||
Reference in New Issue
Block a user