Skip to content

Commit 46a5ff7

Browse files
committed
fix: Don't reset last_old_contact_id if the user disables&reenables the setting
1 parent 5b98030 commit 46a5ff7

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/statistics.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,17 @@ pub(crate) async fn set_last_excluded_msg_id(context: &Context) -> Result<()> {
185185
}
186186

187187
pub(crate) async fn set_last_old_contact_id(context: &Context) -> Result<()> {
188+
let config_exists = context
189+
.sql
190+
.get_raw_config(Config::StatsLastOldContactId.as_ref())
191+
.await?
192+
.is_some();
193+
if config_exists {
194+
// The user had statistics-sending enabled already in the past,
195+
// keep the 'last old contact id' as-is
196+
return Ok(());
197+
}
198+
188199
let last_contact_id: u64 = context
189200
.sql
190201
.query_get_value("SELECT MAX(id) FROM contacts", ())

0 commit comments

Comments
 (0)