Software / code / prosody-modules
Changeset
4050:1eb2b9483081
mod_adhoc_dataforms_demo: Treat 'execute' action as 'next' except in first step
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Tue, 23 Jun 2020 19:54:06 +0200 |
| parents | 4049:78f1de5301fc |
| children | 4051:91e2e510e17c |
| files | mod_adhoc_dataforms_demo/mod_adhoc_dataforms_demo.lua |
| diffstat | 1 files changed, 7 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_adhoc_dataforms_demo/mod_adhoc_dataforms_demo.lua Tue Jun 23 19:40:55 2020 +0200 +++ b/mod_adhoc_dataforms_demo/mod_adhoc_dataforms_demo.lua Tue Jun 23 19:54:06 2020 +0200 @@ -134,6 +134,12 @@ .. serialization.serialize(state, { fatal = false }), }; end + if state and data.action == "execute" then + data.action = "next"; + elseif not state and data.action == "next" then + -- Prevent jumping directly to step 2 + return { status = "canceled", error = "Invalid action" }; + end state = state or { step = 1, forms = { } }; if data.action == "next" then @@ -163,6 +169,7 @@ local next_step = { status = "executing", form = current_form, + default = "next", actions = { "next", "complete" },