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 def load_encrypted_config
@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 end
def build_sms_value def build_sms_value

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

@ -4,11 +4,11 @@
<%= image_tag current_account.logo, class: 'w-16 h-16 object-contain rounded-lg', alt: 'Company logo' %> <%= image_tag current_account.logo, class: 'w-16 h-16 object-contain rounded-lg', alt: 'Company logo' %>
<div> <div>
<p class="font-medium"><%= current_account.logo.filename %></p> <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>
</div> </div>
<% end %> <% 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"> <div class="form-control">
<%= f.label :logo, 'Upload logo', class: 'label' %> <%= 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' %> <%= 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' %> <%= link_to t('storage'), settings_storage_index_path, class: 'text-base hover:bg-base-300' %>
</li> </li>
<% end %> <% 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> <li>
<%= link_to 'SMS', settings_sms_path, class: 'text-base hover:bg-base-300' %> <%= link_to 'SMS', settings_sms_path, class: 'text-base hover:bg-base-300' %>
</li> </li>

@ -14,10 +14,11 @@ RSpec.describe 'Account Logo' do
expect(page).to have_content(I18n.t('company_logo')) expect(page).to have_content(I18n.t('company_logo'))
end end
it 'shows a placeholder message in single-tenant mode' do it 'shows the logo upload form' do
visit settings_personalization_path 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 end
context 'when a logo is attached' do context 'when a logo is attached' do

@ -8,10 +8,11 @@ RSpec.describe 'SMS Settings' do
sign_in(user) sign_in(user)
end 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 visit settings_sms_path
expect(page).to have_content('SMS') 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
end end

@ -8,9 +8,10 @@ RSpec.describe 'SSO Settings' do
sign_in(user) sign_in(user)
end end
it 'shows a placeholder in single-tenant mode' do it 'shows SSO settings page' do
visit settings_sso_index_path 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
end end

Loading…
Cancel
Save