.CRM cases system folder visiblity

This commit is contained in:
Karel Pičman 2025-03-18 13:23:23 +01:00
parent da1706d0fc
commit fc3109daba

View File

@ -118,7 +118,7 @@ class DmsfFolder < ApplicationRecord
if folder&.system if folder&.system
return false unless allow_system || User.current.allowed_to?(:display_system_folders, folder.project) return false unless allow_system || User.current.allowed_to?(:display_system_folders, folder.project)
if %(.Issues .CRM cases).exclude?(folder.title) && if %w[.Issues .CRM\ cases].exclude?(folder.title) &&
!folder.issue&.visible?(User.current) && !folder.issue&.visible?(User.current) &&
!folder.easy_crm_case&.visible?(User.current) !folder.easy_crm_case&.visible?(User.current)
return false return false
@ -487,16 +487,16 @@ class DmsfFolder < ApplicationRecord
end end
def easy_crm_case def easy_crm_case
if easy_crm_case.nil? && system if @easy_crm_case.nil? && system
case_id = title.to_i case_id = title.to_i
begin begin
ecc = 'EasyCrmCase'.constantize ecc = 'EasyCrmCase'.constantize
rescue NameError => _e rescue NameError => _e
ecc = nil ecc = nil
end end
easy_crm_case = EasyCrmCase.find_by(id: case_id) if ecc && case_id.positive? @easy_crm_case = EasyCrmCase.find_by(id: case_id) if ecc && case_id.positive?
end end
easy_crm_case @easy_crm_case
end end
def update_from_params(params) def update_from_params(params)