From 06e59b2e91e73f613c29dfc2fe0cc7015bf2eb2c Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Tue, 28 Mar 2023 15:39:30 -0500 Subject: [PATCH] Show "link" to contact support if snikket creation is slow --- forms/registration/snikket_wait.rb | 15 +++++++++++++++ lib/registration.rb | 9 ++++----- test/test_registration.rb | 5 +++-- 3 files changed, 22 insertions(+), 7 deletions(-) create mode 100644 forms/registration/snikket_wait.rb diff --git a/forms/registration/snikket_wait.rb b/forms/registration/snikket_wait.rb new file mode 100644 index 0000000000000000000000000000000000000000..e7697a7ef764076e48b5965d28a62c37b1fe837f --- /dev/null +++ b/forms/registration/snikket_wait.rb @@ -0,0 +1,15 @@ +result! +title "Snikket Starting..." + +instructions( + "Your instance #{@domain} is starting up. " \ + "This may take several minutes. " \ + "Press next to check if it is ready." +) + +field( + label: "If this takes more than 10 minutes, tap here to contact support", + var: "support", + type: "jid-single", + value: CONFIG[:notify_from] +) diff --git a/lib/registration.rb b/lib/registration.rb index 91f0c78bfd8be9fe4ece9b46fda79a3f6a9dd565..7a6eae9f3cdfc8738cc1132d6095927cb4d3dfb1 100644 --- a/lib/registration.rb +++ b/lib/registration.rb @@ -616,11 +616,10 @@ class Registration def write Command.reply { |reply| reply.allowed_actions = [:next] - reply.note_type = :info - reply.note_text = - "Your instance #{@instance.domain} is starting up. " \ - "This may take several minutes. " \ - "Press next to check if it is ready." + reply.command << FormTemplate.render( + "registration/snikket_wait", + domain: @instance.domain + ) }.then { GetInvite.for(@instance).then(&:write) } end end diff --git a/test/test_registration.rb b/test/test_registration.rb index 719fa30e6b3631155681fa0b78dc95da811c59e6..6b7fd5c84857f724501eea0fb17f42225cfbab2a 100644 --- a/test/test_registration.rb +++ b/test/test_registration.rb @@ -1100,8 +1100,9 @@ class RegistrationTest < Minitest::Test :write, EMPromise.reject(:test_result), [Matching.new do |iq| - assert_equal :info, iq.note_type - assert iq.note.content =~ / test\.snikket\.chat / + assert_equal :result, iq.form.type + assert iq.form.instructions =~ / test\.snikket\.chat / + assert_equal "jid-single", iq.form.field("support").type end] )