share template only hosted

pull/220/head^2
Pete Matsyburka 2 years ago
parent 57c7dc1b5e
commit f83674b934

@ -54,11 +54,15 @@ class DashboardController < ApplicationController
rel = templates.active.preload(:author).order(id: :desc)
if params[:q].blank?
if Docuseal.multitenant?
rel = rel.where(folder_id: current_account.default_template_folder.id)
else
shared_template_ids =
TemplateSharing.where(account_id: [current_account.id, TemplateSharing::ALL_ID]).select(:template_id)
rel = rel.where(folder_id: current_account.default_template_folder.id).or(rel.where(id: shared_template_ids))
end
end
Templates.search(rel, params[:q])
end

@ -18,7 +18,7 @@
</div>
</div>
<%= render 'templates/embedding', template: @template %>
<% if can?(:manage, TemplateSharing.new(template: @template)) %>
<% if can?(:manage, TemplateSharing.new(template: @template)) && !Docuseal.multitenant? %>
<%= form_for '', url: template_sharings_testing_index_path, method: :post, html: { class: 'mt-1' } do |f| %>
<%= f.hidden_field :template_id, value: @template.id %>
<div class="flex items-center justify-between">

Loading…
Cancel
Save