fix file url performance

pull/381/head
Pete Matsyburka 1 year ago committed by Oleksandr Turchyn
parent 5dae742361
commit 711427521c

@ -38,12 +38,12 @@ module Api
private private
def authorization_check!(blob) def authorization_check!(blob)
is_authorized = attachment = blob.attachments.take
blob.attachments.all? do |a|
a.name.in?(%w[logo preview_images]) || is_authorized = attachment.name.in?(%w[logo preview_images]) ||
(current_user && a.record.account.id == current_user.account_id) || (current_user && attachment.record.account.id == current_user.account_id) ||
!a.record.account.account_configs.find_or_initialize_by(key: AccountConfig::DOWNLOAD_LINKS_AUTH_KEY).value !attachment.record.account.account_configs
end .find_or_initialize_by(key: AccountConfig::DOWNLOAD_LINKS_AUTH_KEY).value
return if is_authorized return if is_authorized

Loading…
Cancel
Save