diff --git a/CHANGELOG.md b/CHANGELOG.md index db875d2..47abc39 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Slowed down room history download speed ### Fixed +- Chat rendering when deleting and re-joining a room - Spacing in some popups ## v0.1.0 - 2022-08-06 diff --git a/src/vault/euph.rs b/src/vault/euph.rs index b56ddb9..26dc177 100644 --- a/src/vault/euph.rs +++ b/src/vault/euph.rs @@ -472,13 +472,25 @@ impl EuphRequest { } fn delete(conn: &mut Connection, room: String) -> rusqlite::Result<()> { - conn.execute( + let tx = conn.transaction()?; + + tx.execute( " DELETE FROM euph_rooms WHERE room = ? ", - [room], + [&room], )?; + + tx.execute( + " + DELETE FROM euph_trees + WHERE room = ? + ", + [&room], + )?; + + tx.commit()?; Ok(()) } diff --git a/src/vault/prepare.rs b/src/vault/prepare.rs index ab8cb9c..8f55fb0 100644 --- a/src/vault/prepare.rs +++ b/src/vault/prepare.rs @@ -4,7 +4,6 @@ pub fn prepare(conn: &mut Connection) -> rusqlite::Result<()> { println!("Opening vault"); // This temporary table has no foreign key constraint on euph_rooms since // cross-schema constraints like that are not supported by SQLite. - // TODO Remove entries from this table whenever a room is deleted conn.execute_batch( " CREATE TEMPORARY TABLE euph_trees (