tenants test flag

This commit is contained in:
Pete Matsyburka committed 2026-10-13 09:23:38 +03:00
1 parent ced5ab67ab
commit a036483938
3 files changed
+5 -3

No files matched your search

@@ -8,7 +8,9 @@ class TemplateSharingsTestingController < ApplicationController
end end
def create def create
testing_account = Accounts.find_or_create_testing_user(true_user.account).account account = can?(:manage, :tenants_test) ? current_account : true_user.account
testing_account = Accounts.find_or_create_testing_user(account).account
if params[:value] == '1' if params[:value] == '1'
TemplateSharing.create!(ability: :manage, account: testing_account, template: @template) TemplateSharing.create!(ability: :manage, account: testing_account, template: @template)
+1 -1
View File
@@ -26,7 +26,7 @@
<%= t('share_template_with_test_mode') %> <%= t('share_template_with_test_mode') %>
</span> </span>
<submit-form data-on="change"> <submit-form data-on="change">
<%= f.check_box :value, class: 'toggle', checked: @template.template_sharings.exists?(account_id: true_user.account.testing_accounts) %> <%= f.check_box :value, class: 'toggle', checked: @template.template_sharings.exists?(account_id: (can?(:manage, :tenants_test) ? current_account : true_user.account).testing_accounts) %>
</submit-form> </submit-form>
</div> </div>
<% end %> <% end %>
@@ -194,7 +194,7 @@
<%= t('share_template_with_test_mode') %> <%= t('share_template_with_test_mode') %>
</span> </span>
<submit-form data-on="change" class="flex"> <submit-form data-on="change" class="flex">
<%= f.check_box :value, class: 'toggle', checked: @template.template_sharings.exists?(account_id: true_user.account.testing_accounts) %> <%= f.check_box :value, class: 'toggle', checked: @template.template_sharings.exists?(account_id: (can?(:manage, :tenants_test) ? current_account : true_user.account).testing_accounts) %>
</submit-form> </submit-form>
</div> </div>
<% end %> <% end %>