From: Ian Jackson Date: Sun, 27 Mar 2022 00:40:14 +0000 (+0000) Subject: session URL: PresentationLayout is mandatory X-Git-Tag: otter-1.0.0~133 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=961ae2709e343f2c556489115264c641efbbb0fe;p=otter.git session URL: PresentationLayout is mandatory These requests come from xhr_post_then('/_/session/' + layout in script.ts, which gets layout via global-info and ultimately from LoadingRenderContext, which contains a PresentationLayout, not an Option. git grep for "/session" reveals one in apitest, but that one is hardcoded to use /Portrait. Signed-off-by: Ian Jackson --- diff --git a/daemon/session.rs b/daemon/session.rs index 46406a25..28317429 100644 --- a/daemon/session.rs +++ b/daemon/session.rs @@ -72,9 +72,9 @@ struct SessionForm { #[post("/_/session/", format="json", data="
")] #[throws(FER)] fn session(form: Json, - layout: Option>) + layout: Parse) -> Template { - session_inner(form, layout.map(|pl| pl.0))? + session_inner(form, layout.0)? } #[ext] @@ -89,7 +89,7 @@ impl SvgAttrs { } fn session_inner(form: Json, - layout: Option) + layout: PresentationLayout) -> Result { // make session in this game, log a message to other players let iad = lookup_token(form.ptoken.borrow())?; @@ -123,9 +123,7 @@ fn session_inner(form: Json, let gpl = ig.gs.players.byid_mut(player)?; let pr = ig.iplayers.byid(player)?; let tz = &pr.ipl.tz; - if let Some(layout) = layout { - gpl.layout = layout; - } + gpl.layout = layout; let layout = gpl.layout; let nick = gpl.nick.clone(); let movehist = gpl.movehist.clone();