mirror of
https://github.com/chatmail/core.git
synced 2026-05-22 16:26:31 +03:00
fix: mark Saved Messages chat as protected if it exists
Saved Messages chat is created as protected, but for existing accounts we need to do this in a migration.
This commit is contained in:
@@ -1070,6 +1070,24 @@ CREATE INDEX msgs_status_updates_index2 ON msgs_status_updates (uid);
|
|||||||
.await?;
|
.await?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inc_and_check(&mut migration_version, 124)?;
|
||||||
|
if dbversion < migration_version {
|
||||||
|
// Mark Saved Messages chat as protected if it already exists.
|
||||||
|
sql.execute_migration(
|
||||||
|
"UPDATE chats
|
||||||
|
SET protected=1 -- ProtectionStatus::Protected
|
||||||
|
WHERE type==100 -- Chattype::Single
|
||||||
|
AND EXISTS (
|
||||||
|
SELECT 1 FROM chats_contacts cc
|
||||||
|
WHERE cc.chat_id==chats.id
|
||||||
|
AND cc.contact_id=1
|
||||||
|
)
|
||||||
|
",
|
||||||
|
migration_version,
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
}
|
||||||
|
|
||||||
let new_version = sql
|
let new_version = sql
|
||||||
.get_raw_config_int(VERSION_CFG)
|
.get_raw_config_int(VERSION_CFG)
|
||||||
.await?
|
.await?
|
||||||
|
|||||||
Reference in New Issue
Block a user