Plugin settings "File default notifications" does not apply! #556

This commit is contained in:
Karel Picman 2016-08-10 10:22:55 +02:00
parent 6ae17d1ec3
commit 67f5a3fcb7

View File

@ -46,11 +46,19 @@ module RedmineDmsf
:class_name => 'DmsfLink', :foreign_key => 'project_id', :dependent => :destroy
has_many :dmsf_links, -> { where dmsf_folder_id: nil },
:class_name => 'DmsfLink', :foreign_key => 'project_id', :dependent => :destroy
before_save :set_default_dmsf_notification
end
end
module InstanceMethods
def set_default_dmsf_notification
if self.new_record?
self.dmsf_notification = Setting.plugin_redmine_dmsf['dmsf_default_notifications'] == '1'
end
end
def dmsf_count
file_count = self.dmsf_files.visible.count + self.file_links.visible.count
folder_count = self.dmsf_folders.visible.count + self.folder_links.visible.count