Drop Current.account and just use Account.sole
I had reintroduced this indacb53b8after David removed it in6bbf68a4, but now I agree we don't need it. Also, fix a CORS error when trying to redirect a user to an untenanted path after login (see https://fizzy.37signals.com/5986089/collections/2/cards/1032).
This commit is contained in:
@@ -15,7 +15,7 @@ class BootstrapSignalId
|
||||
puts "\n# tenant: #{tenant}"
|
||||
|
||||
next unless check_account_preconditions
|
||||
create_signal_id_account if Account.first.queenbee_id.nil?
|
||||
create_signal_id_account if Account.sole.queenbee_id.nil?
|
||||
|
||||
create_signal_id_users
|
||||
end
|
||||
@@ -42,7 +42,7 @@ class BootstrapSignalId
|
||||
signal_id_account = SignalId::Account.find_by!(queenbee_id: queenbee_account.id)
|
||||
signal_id_account.update_column :subdomain, ApplicationRecord.current_tenant
|
||||
|
||||
account = Account.first
|
||||
account = Account.sole
|
||||
account.queenbee_id = queenbee_account.id
|
||||
account.name = ApplicationRecord.current_tenant
|
||||
account.save!
|
||||
@@ -50,7 +50,7 @@ class BootstrapSignalId
|
||||
end
|
||||
|
||||
def create_signal_id_users
|
||||
signal_account = Account.first.signal_account
|
||||
signal_account = Account.sole.signal_account
|
||||
|
||||
User.find_each do |user|
|
||||
if !user.system? && user.signal_user_id.nil?
|
||||
|
||||
@@ -4,7 +4,7 @@ COLLECTIONS_COUNT = 100
|
||||
CARDS_PER_COLLECTION = 50
|
||||
|
||||
ApplicationRecord.current_tenant = "development-tenant"
|
||||
account = Account.first
|
||||
account = Account.sole
|
||||
user = account.users.first
|
||||
Current.session = user.sessions.last
|
||||
workflow = account.workflows.first
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
require_relative "../config/environment"
|
||||
|
||||
ApplicationRecord.with_each_tenant do |tenant|
|
||||
account = Account.first
|
||||
account = Account.sole
|
||||
signal_account = account.signal_account
|
||||
|
||||
signal_users = SignalId::User.where(account_id: signal_account.id)
|
||||
|
||||
@@ -25,7 +25,7 @@ def fix_attachments(rich_text)
|
||||
end
|
||||
|
||||
ApplicationRecord.with_each_tenant do |tenant|
|
||||
account_id = Account.first.queenbee_id
|
||||
account_id = Account.sole.queenbee_id
|
||||
|
||||
unless account_id
|
||||
puts "Skipping URL fixup for tenant: #{tenant}"
|
||||
@@ -37,7 +37,7 @@ ApplicationRecord.with_each_tenant do |tenant|
|
||||
domain = domains[Rails.env] || domains["production"]
|
||||
regex = %r{://\w+\.#{domain}/}
|
||||
|
||||
pp [ Account.first.name, account_id, domain, regex ]
|
||||
pp [ Account.sole.name, account_id, domain, regex ]
|
||||
puts
|
||||
|
||||
Card.find_each do |card|
|
||||
|
||||
@@ -3,7 +3,7 @@ require_relative "../../config/environment"
|
||||
CARDS_COUNT = 200
|
||||
|
||||
ApplicationRecord.current_tenant = "37signals"
|
||||
account = Account.first
|
||||
account = Account.sole
|
||||
user = User.first
|
||||
Current.session = user.sessions.last
|
||||
collection = Collection.first
|
||||
|
||||
@@ -7,7 +7,7 @@ tenant_names = []
|
||||
ApplicationRecord.with_each_tenant do |tenant|
|
||||
next if tenant == "#{Rails.env}-tenant"
|
||||
|
||||
account = Account.first
|
||||
account = Account.sole
|
||||
queenbee_id = account.queenbee_id
|
||||
tenant_names << { from: tenant, to: queenbee_id }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user