From 56820af263efe52619845930639068cafa960321 Mon Sep 17 00:00:00 2001 From: Karel Picman Date: Thu, 16 Feb 2017 12:04:39 +0100 Subject: [PATCH] Feature Request: Linking Issues and DMSF Documents type: enhancement #48 --- CHANGELOG.md | 2 ++ app/models/dmsf_file.rb | 7 +++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ec140ece..77683d6c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,8 +25,10 @@ Changelog for Redmine DMSF * Bug: #663 - Locked documnts on My page * Bug: #662 - Broken paging on the Add approver form * New: #655 - ERROR: Couldn't find Project with identifier=desktop.ini +* New: #654 - Non-versioned files should not go to trash bin when deleted * Bug: #652 - Missing date picker when creating new file * Bug: #651 - Incomplete copy of a file to another project +* New: #648 - Lock duration * New: #641 - Documents export * New: #635 - Edit approval workflow steps * Bug: #632 - database migration error (from ver 0.9.1 to ver 1.5.8) diff --git a/app/models/dmsf_file.rb b/app/models/dmsf_file.rb index 8b21fba3..e8505e5b 100644 --- a/app/models/dmsf_file.rb +++ b/app/models/dmsf_file.rb @@ -330,10 +330,9 @@ class DmsfFile < ActiveRecord::Base project_conditions = [] project_conditions << Project.allowed_to_condition(user, :view_dmsf_files) project_conditions << "#{DmsfFile.table_name}.project_id IN (#{project_ids.join(',')})" if project_ids.present? - - results = [] - - scope = self.visible.joins(:project, :dmsf_file_revisions) + + scope = self.visible.joins(:dmsf_file_revisions).joins( + "JOIN projects ON dmsf_files.container_id = projects.id AND dmsf_files.container_type = 'Project'") scope = scope.limit(options[:limit]) unless options[:limit].blank? scope = scope.where(limit_options) unless limit_options.blank? scope = scope.where(project_conditions.join(' AND '))