refactor: read default room owner from room settings

This commit is contained in:
Eyejoker
2026-03-31 20:48:30 +09:00
parent fc4eaefeda
commit 1fccc37fe8
3 changed files with 108 additions and 34 deletions

View File

@@ -913,6 +913,22 @@ export function _initTestDatabaseFromFile(dbPath: string): void {
createSchema(db);
}
/** @internal - for tests only. */
export function _setStoredRoomOwnerAgentTypeForTests(
chatJid: string,
ownerAgentType: AgentType | null,
): void {
if (!db) {
throw new Error('Database not initialized');
}
db.prepare(
`UPDATE room_settings
SET owner_agent_type = ?,
updated_at = ?
WHERE chat_jid = ?`,
).run(ownerAgentType, new Date().toISOString(), chatJid);
}
/**
* Store chat metadata only (no message content).
* Used for all chats to enable group discovery without storing sensitive content.