let quota-warning reappear after import, rewarn at 95% (#2702)

* let quota-warning reappear after import

an import removes all device-messages,
including the quota warning.

resetting `Config::QuotaExceeding` makes sure,
the warning reappears soon after import -
otherwise the warning would reappear only after
storage is cleaned up and exceeds again.

* a second quota warning when 95% storage exceeded

* factor out warning-check and add a test for that
This commit is contained in:
bjoern
2021-09-22 12:41:35 +02:00
committed by GitHub
parent 66a5e0743d
commit a5826d6a06
2 changed files with 45 additions and 13 deletions

View File

@@ -2940,6 +2940,8 @@ pub async fn was_device_msg_ever_added(context: &Context, label: &str) -> Result
// no wrong information are shown in the device chat
// - deletion in `devmsglabels` makes sure,
// deleted messages are resetted and useful messages can be added again
// - we reset the config-option `QuotaExceeding`
// that is used as a helper to drive the corresponding device message.
pub(crate) async fn delete_and_reset_all_device_msgs(context: &Context) -> Result<()> {
context
.sql
@@ -2952,6 +2954,7 @@ pub(crate) async fn delete_and_reset_all_device_msgs(context: &Context) -> Resul
.sql
.execute("DELETE FROM devmsglabels;", paramsv![])
.await?;
context.set_config(Config::QuotaExceeding, None).await?;
Ok(())
}