Alternative.disabled: announced but not yet takeable
Test / test (push) Successful in 24s

The button renders disabled (title 'Not yet') and submit_answer
refuses the alternative server-side - lysbue's disabled flag, back as
content, for advertising a path before it works.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Bendik Aagaard Lynghaug
2026-08-25 20:25:49 +02:00
co-authored by Claude Fable 5
parent be54f54804
commit 1a45839699
3 changed files with 26 additions and 1 deletions
+14 -1
View File
@@ -1177,7 +1177,17 @@ fn AlternativeCard(
children=move |e| view! { <p class="alt-encouragement">{e}</p> }
/>
</div>
{if is_gateway {
{if alternative.disabled {
// Advertised, not yet takeable: the label
// stays (it says what will be possible),
// the button doesn't act.
view! {
<button type="button" class="alt-submit soon" disabled=true title="Not yet">
{button_label.clone()}
</button>
}
.into_any()
} else if is_gateway {
let href = alternative.action.clone().unwrap_or_default();
view! {
<a class="alt-submit" href=href>{button_label.clone()}</a>
@@ -1860,6 +1870,9 @@ pub async fn submit_answer(
.iter()
.find(|a| a.name == alternative)
.ok_or_else(|| ServerFnError::new("unknown alternative"))?;
if alt.disabled {
return Err(ServerFnError::new("this alternative isn't open yet"));
}
let next = alt.action.clone();
let record_as = alt.record_as.clone();