Fix group metadata sync setting epoch timestamp for new groups (#15)
updateChatName() was inserting new groups with last_message_time set to Unix epoch (1970-01-01), causing newly discovered groups to appear at the bottom of activity-ordered listings. Changed to use current time for new groups while preserving existing timestamps for known groups. https://claude.ai/code/session_018rcZvALfF3ND2jfcvBaFo2 Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -95,14 +95,15 @@ export function storeChatMetadata(chatJid: string, timestamp: string, name?: str
|
||||
}
|
||||
|
||||
/**
|
||||
* Update chat name without changing timestamp.
|
||||
* Update chat name without changing timestamp for existing chats.
|
||||
* New chats get the current time as their initial timestamp.
|
||||
* Used during group metadata sync.
|
||||
*/
|
||||
export function updateChatName(chatJid: string, name: string): void {
|
||||
db.prepare(`
|
||||
INSERT INTO chats (jid, name, last_message_time) VALUES (?, ?, ?)
|
||||
ON CONFLICT(jid) DO UPDATE SET name = excluded.name
|
||||
`).run(chatJid, name, new Date(0).toISOString());
|
||||
`).run(chatJid, name, new Date().toISOString());
|
||||
}
|
||||
|
||||
export interface ChatInfo {
|
||||
|
||||
Reference in New Issue
Block a user