From 237830d91c9575d396463e50c8d9963f8f57e1c4 Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Wed, 18 Jun 2025 14:39:54 -0400 Subject: [PATCH] During signup, name beta accounts distinctly because Launchpad will present both in the UI, but will not be able to redirect to a beta fizzy account from production launchpad (or vice versa). --- app/models/signup.rb | 8 +++++++- test/models/signup_test.rb | 11 +++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/app/models/signup.rb b/app/models/signup.rb index 494dc883a..40996a1f4 100644 --- a/app/models/signup.rb +++ b/app/models/signup.rb @@ -116,7 +116,7 @@ class Signup { skip_remote: true, # Fizzy creates its own local account product_name: "fizzy", - name: company_name.presence || signal_identity.name, + name: queenbee_account_name, owner_identity_id: signal_identity.id, trial: false, subscription: subscription_attributes, @@ -131,4 +131,10 @@ class Signup def request_attributes { remote_address: Current.ip_address, user_agent: Current.user_agent, referrer: Current.referrer } end + + def queenbee_account_name + name = company_name.presence || signal_identity.name + name += " (Beta)" if Rails.env.beta? + name + end end diff --git a/test/models/signup_test.rb b/test/models/signup_test.rb index 953628d92..0dfd2bd87 100644 --- a/test/models/signup_test.rb +++ b/test/models/signup_test.rb @@ -25,6 +25,7 @@ class SignupTest < ActiveSupport::TestCase assert @signup.signal_account assert @signup.signal_account.persisted? assert_equal @signup.signal_identity, @signup.signal_account.owner.identity + assert_equal @signup.company_name, @signup.signal_account.name assert @signup.account assert @signup.account.persisted? @@ -36,6 +37,16 @@ class SignupTest < ActiveSupport::TestCase assert_includes ApplicationRecord.tenants, @signup.signal_account.subdomain end + test "the new account is named with company name if present" do + assert_equal @signup.company_name, @signup.send(:queenbee_account_name) + end + + test "in beta, the new account is named distinctly" do + Rails.stubs(:env).returns(stub(beta?: true)) + + assert_equal "#{@signup.company_name} (Beta)", @signup.send(:queenbee_account_name) + end + test "#process creates all the necessary objects for an existing identity" do signal_identity = SignalId::Identity.find_by_email_address("david@37signals.com")