mirror of
https://github.com/mikedilger/gossip.git
synced 2024-09-29 00:11:01 +00:00
fix: Last contact list edit: default to now if unset
This commit is contained in:
parent
0986d574a6
commit
d82be4b91c
@ -531,12 +531,16 @@ impl Storage {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn read_last_contact_list_edit(&self) -> Result<Option<i64>, Error> {
|
||||
pub fn read_last_contact_list_edit(&self) -> Result<i64, Error> {
|
||||
let txn = self.env.read_txn()?;
|
||||
|
||||
match self.general.get(&txn, b"last_contact_list_edit")? {
|
||||
None => Ok(None),
|
||||
Some(bytes) => Ok(Some(i64::from_be_bytes(bytes[..8].try_into().unwrap()))),
|
||||
None => {
|
||||
let now = Unixtime::now().unwrap();
|
||||
self.write_last_contact_list_edit(now.0, None)?;
|
||||
Ok(now.0)
|
||||
}
|
||||
Some(bytes) => Ok(i64::from_be_bytes(bytes[..8].try_into().unwrap())),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -115,8 +115,7 @@ pub(super) fn update(app: &mut GossipUi, ctx: &Context, _frame: &mut eframe::Fra
|
||||
ui.add_space(10.0);
|
||||
|
||||
let last_contact_list_edit = match GLOBALS.storage.read_last_contact_list_edit() {
|
||||
Ok(Some(date)) => date,
|
||||
Ok(None) => 0,
|
||||
Ok(date) => date,
|
||||
Err(e) => {
|
||||
tracing::error!("{}", e);
|
||||
0
|
||||
|
Loading…
Reference in New Issue
Block a user