Fix EncryptedConfig SMS constant, route helpers, and update tests for removed Pro refs

pull/687/head
Wabo 2 weeks ago
parent b755c147e8
commit f871ea40d6

@ -42,7 +42,7 @@ class SmsSettingsController < ApplicationController
def load_encrypted_config
@encrypted_config =
EncryptedConfig.find_or_initialize_by(account: current_account, key: 'sms_configs')
EncryptedConfig.find_or_initialize_by(account: current_account, key: EncryptedConfig::SMS_CONFIGS_KEY)
end
def build_sms_value

@ -27,7 +27,8 @@ class EncryptedConfig < ApplicationRecord
ESIGN_CERTS_KEY = 'esign_certs',
TIMESTAMP_SERVER_URL_KEY = 'timestamp_server_url',
APP_URL_KEY = 'app_url',
GOOGLE_SSO_KEY = 'google_sso'
GOOGLE_SSO_KEY = 'google_sso',
SMS_CONFIGS_KEY = 'sms_configs'
].freeze
belongs_to :account

@ -4,11 +4,11 @@
<%= image_tag current_account.logo, class: 'w-16 h-16 object-contain rounded-lg', alt: 'Company logo' %>
<div>
<p class="font-medium"><%= current_account.logo.filename %></p>
<%= button_to t('remove'), account_logo_path, method: :delete, class: 'btn btn-sm btn-outline btn-error mt-1', data: { turbo: false } %>
<%= button_to t('remove'), settings_account_logo_path, method: :delete, class: 'btn btn-sm btn-outline btn-error mt-1', data: { turbo: false } %>
</div>
</div>
<% end %>
<%= form_with url: account_logo_path, local: true, class: 'space-y-3' do |f| %>
<%= form_with url: settings_account_logo_path, local: true, class: 'space-y-3' do |f| %>
<div class="form-control">
<%= f.label :logo, 'Upload logo', class: 'label' %>
<%= f.file_field :logo, accept: 'image/png,image/jpeg,image/svg+xml', class: 'file-input file-input-bordered w-full' %>

@ -23,7 +23,7 @@
<%= link_to t('storage'), settings_storage_index_path, class: 'text-base hover:bg-base-300' %>
</li>
<% end %>
<% if can?(:read, EncryptedConfig.new(key: 'submitter_invitation_sms', account: current_account)) && true_user == current_user %>
<% if can?(:read, EncryptedConfig.new(key: EncryptedConfig::SMS_CONFIGS_KEY, account: current_account)) && true_user == current_user %>
<li>
<%= link_to 'SMS', settings_sms_path, class: 'text-base hover:bg-base-300' %>
</li>

@ -14,10 +14,11 @@ RSpec.describe 'Account Logo' do
expect(page).to have_content(I18n.t('company_logo'))
end
it 'shows a placeholder message in single-tenant mode' do
it 'shows the logo upload form' do
visit settings_personalization_path
expect(page).to have_content(I18n.t('unlock_with_docuseal_pro'))
expect(page).to have_content('Upload logo')
expect(page).to have_css('input[type="file"]')
end
context 'when a logo is attached' do

@ -8,10 +8,11 @@ RSpec.describe 'SMS Settings' do
sign_in(user)
end
it 'shows the SMS settings page with a placeholder in non-multitenant mode' do
it 'shows the SMS settings page with provider form' do
visit settings_sms_path
expect(page).to have_content('SMS')
expect(page).to have_content(I18n.t('unlock_with_docuseal_pro'))
expect(page).to have_content('Provider')
expect(page).to have_select('Provider')
end
end

@ -8,9 +8,10 @@ RSpec.describe 'SSO Settings' do
sign_in(user)
end
it 'shows a placeholder in single-tenant mode' do
it 'shows SSO settings page' do
visit settings_sso_index_path
expect(page).to have_content(I18n.t('unlock_with_docuseal_pro'))
expect(page).to have_content('SSO')
expect(page).to have_content('SAML_CONFIGS')
end
end

Loading…
Cancel
Save