From: Ian Jackson Date: Thu, 12 Nov 2020 12:18:45 +0000 (+0000) Subject: wip move TokensRevealed X-Git-Tag: otter-0.2.0~534 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=c131c15afa3249845485e66a2e75c23397a36a8c;p=otter.git wip move TokensRevealed Signed-off-by: Ian Jackson --- diff --git a/src/global.rs b/src/global.rs index 4b703b9c..1b09cdc2 100644 --- a/src/global.rs +++ b/src/global.rs @@ -639,15 +639,13 @@ impl<'ig> InstanceGuard<'ig> { fn player_access_reset_redeliver(&mut self, accounts: &mut AccountsGuard, player: PlayerId, - authorised: Authorisation, + _auth: Authorisation, reset: bool) -> Option { let acctid = self.iplayers.byid(player)?.ipl.acctid; - let (access, acctid) = accounts.with_entry_mut( - acctid, authorised, None, - |acct, acctid| - { + let access = { + let (acct, _) = accounts.lookup(acctid)?; let access = acct.access.clone(); let desc = access.describe_html(); let now = Timestamp::now(); @@ -655,14 +653,16 @@ impl<'ig> InstanceGuard<'ig> { account: (*acct.account).clone(), desc, }; + // xxx show tokens revealed when joining game + // xxx clear tokens revealed when logs is cleared self.iplayers.byid_mut(player)?.ipl.tokens_revealed.entry(revk) .or_insert(TokenRevelationValue { latest: now, earliest: now, }) .latest = now; - Ok::<_,MgmtError>((access, acctid)) - })?.map_err(|(e,_)|e)??; + access + }; if reset { self.save_access_now()?;