Show "link" to contact support if snikket creation is slow

Stephen Paul Weber created

Change summary

forms/registration/snikket_wait.rb | 15 +++++++++++++++
lib/registration.rb                |  9 ++++-----
test/test_registration.rb          |  5 +++--
3 files changed, 22 insertions(+), 7 deletions(-)

Detailed changes

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]
+)

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

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]
 				)