From 2020f6c136281eb0b0d8e89db57b1ff1d585b1fe Mon Sep 17 00:00:00 2001 From: Pete Matsyburka Date: Thu, 26 Jun 2025 07:47:29 +0300 Subject: [PATCH] make shared templates searchable --- lib/submissions.rb | 3 ++- lib/templates.rb | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/submissions.rb b/lib/submissions.rb index 0fb3b0e0..e8085169 100644 --- a/lib/submissions.rb +++ b/lib/submissions.rb @@ -50,7 +50,8 @@ module Submissions arel, Submission.where( template_id: SearchEntry.where(record_type: 'Template') - .where(account_id: current_user.account_id) + .where(account_id: [current_user.account_id, + current_user.account.linked_account_account&.account_id].compact) .where(*SearchEntries.build_tsquery(keyword)) .select(:record_id) ).select(:id).arel diff --git a/lib/templates.rb b/lib/templates.rb index 95033f02..e1dbdf33 100644 --- a/lib/templates.rb +++ b/lib/templates.rb @@ -56,7 +56,8 @@ module Templates templates.where( id: SearchEntry.where(record_type: 'Template') - .where(account_id: current_user.account_id) + .where(account_id: [current_user.account_id, + current_user.account.linked_account_account&.account_id].compact) .where(*SearchEntries.build_tsquery(keyword)) .select(:record_id) )