Skip to content

Commit

Permalink
Plugin settings 'Display notified recipients' does not apply! #1565
Browse files Browse the repository at this point in the history
  • Loading branch information
picman committed Nov 26, 2024
1 parent 3062440 commit 9ee3b34
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 29 deletions.
7 changes: 3 additions & 4 deletions app/models/dmsf_query.rb
Original file line number Diff line number Diff line change
Expand Up @@ -258,10 +258,9 @@ def self.default(project = nil, user = User.current)
return query if query&.visibility == VISIBILITY_PUBLIC

# Global default
if (query_id = RedmineDmsf.dmsf_default_query).present?
query = find_by(id: query_id)
return query if query&.visibility == VISIBILITY_PUBLIC
end
query = find_by(id: RedmineDmsf.dmsf_default_query)
return query if query&.visibility == VISIBILITY_PUBLIC

nil
end

Expand Down
81 changes: 56 additions & 25 deletions lib/redmine_dmsf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,35 @@ def dmsf_max_email_filesize
end

def dmsf_storage_directory
value = Setting.plugin_redmine_dmsf['dmsf_storage_directory'].presence || 'files/dmsf'
value.strip
if Setting.plugin_redmine_dmsf['dmsf_storage_directory'].present?
Setting.plugin_redmine_dmsf['dmsf_storage_directory'].strip
else
'files/dmsf'
end
end

def dmsf_index_database
value = Setting.plugin_redmine_dmsf['dmsf_index_database'].presence || File.expand_path('dmsf_index', Rails.root)
value.strip
if Setting.plugin_redmine_dmsf['dmsf_index_database'].present?
Setting.plugin_redmine_dmsf['dmsf_index_database'].strip
else
File.expand_path('dmsf_index', Rails.root)
end
end

def dmsf_stemming_lang
value = Setting.plugin_redmine_dmsf['dmsf_stemming_lang'].presence || 'english'
value.strip
if Setting.plugin_redmine_dmsf['dmsf_stemming_lang'].present?
Setting.plugin_redmine_dmsf['dmsf_stemming_lang'].strip
else
'english'
end
end

def dmsf_stemming_strategy
value = Setting.plugin_redmine_dmsf['dmsf_stemming_strategy'].presence || 'STEM_NONE'
value.strip
if Setting.plugin_redmine_dmsf['dmsf_stemming_strategy'].present?
Setting.plugin_redmine_dmsf['dmsf_stemming_strategy'].strip
else
'STEM_NONE'
end
end

def dmsf_webdav?
Expand All @@ -67,22 +79,31 @@ def dmsf_display_notified_recipients?
end

def dmsf_global_title_format
value = Setting.plugin_redmine_dmsf['dmsf_global_title_format'].presence || ''
value.strip
if Setting.plugin_redmine_dmsf['dmsf_global_title_format'].present?
Setting.plugin_redmine_dmsf['dmsf_global_title_format'].strip
else
''
end
end

def dmsf_columns
Setting.plugin_redmine_dmsf['dmsf_columns'].presence || DmsfFolder::DEFAULT_COLUMNS
end

def dmsf_webdav_ignore
value = Setting.plugin_redmine_dmsf['dmsf_webdav_ignore'].presence || '^(\._|\.DS_Store$|Thumbs.db$)'
value.strip
if Setting.plugin_redmine_dmsf['dmsf_webdav_ignore'].present?
Setting.plugin_redmine_dmsf['dmsf_webdav_ignore'].strip
else
'^(\._|\.DS_Store$|Thumbs.db$)'
end
end

def dmsf_webdav_disable_versioning
value = Setting.plugin_redmine_dmsf['dmsf_webdav_disable_versioning'].presence || '^\~\$|\.tmp$'
value.strip
if Setting.plugin_redmine_dmsf['dmsf_webdav_disable_versioning'].present?
Setting.plugin_redmine_dmsf['dmsf_webdav_disable_versioning'].strip
else
'^\~\$|\.tmp$'
end
end

def dmsf_keep_documents_locked?
Expand All @@ -102,14 +123,19 @@ def dmsf_act_as_attachable?
end

def dmsf_documents_email_from
value = Setting.plugin_redmine_dmsf['dmsf_documents_email_from'].presence ||
"#{User.current.name} <#{User.current.mail}>"
value.strip
if Setting.plugin_redmine_dmsf['dmsf_documents_email_from'].present?
Setting.plugin_redmine_dmsf['dmsf_documents_email_from'].strip
else
"#{User.current.name} <#{User.current.mail}>"
end
end

def dmsf_documents_email_reply_to
value = Setting.plugin_redmine_dmsf['dmsf_documents_email_reply_to'].presence || ''
value.strip
if Setting.plugin_redmine_dmsf['dmsf_documents_email_reply_to'].present?
Setting.plugin_redmine_dmsf['dmsf_documents_email_reply_to'].strip
else
''
end
end

def dmsf_documents_email_links_only?
Expand Down Expand Up @@ -165,8 +191,11 @@ def dmsf_max_notification_receivers_info
end

def office_bin
value = Setting.plugin_redmine_dmsf['office_bin'].presence || ''
value.strip
if Setting.plugin_redmine_dmsf['office_bin'].present?
Setting.plugin_redmine_dmsf['office_bin'].strip
else
''
end
end

def dmsf_global_menu_disabled?
Expand All @@ -178,8 +207,7 @@ def dmsf_global_menu_disabled?
end

def dmsf_default_query
value = Setting.plugin_redmine_dmsf['dmsf_default_query'].presence || ''
value.strip
Setting.plugin_redmine_dmsf['dmsf_default_query'].to_i
end

def empty_minor_version_by_default?
Expand All @@ -199,8 +227,11 @@ def remove_original_documents_module?
end

def dmsf_webdav_authentication
value = Setting.plugin_redmine_dmsf['dmsf_webdav_authentication'].presence || 'Basic'
value.strip
if Setting.plugin_redmine_dmsf['dmsf_webdav_authentication'].present?
Setting.plugin_redmine_dmsf['dmsf_webdav_authentication'].strip
else
'Basic'
end
end
end
end
Expand Down

0 comments on commit 9ee3b34

Please sign in to comment.