summaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2009-04-05 11:52:49 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2009-04-05 11:52:49 +0000
commitb6600d5fe97261ef03fc334b36af877499225d07 (patch)
tree46abec1667e476c65783bf85e6af0df9895640b1 /app/models
parent37da5ba18776a7a1e4549e7bc2af48d87d67234a (diff)
downloadredmine-b6600d5fe97261ef03fc334b36af877499225d07.tar.gz
redmine-b6600d5fe97261ef03fc334b36af877499225d07.zip
Merged r2563, r2566, r2567, r2568, r2569, r2582 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.8-stable@2650 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models')
-rw-r--r--app/models/attachment.rb2
-rw-r--r--app/models/query.rb6
-rw-r--r--app/models/repository/subversion.rb6
3 files changed, 9 insertions, 5 deletions
diff --git a/app/models/attachment.rb b/app/models/attachment.rb
index 2ba75a3fd..2957b9dd1 100644
--- a/app/models/attachment.rb
+++ b/app/models/attachment.rb
@@ -33,7 +33,7 @@ class Attachment < ActiveRecord::Base
:author_key => :author_id,
:find_options => {:select => "#{Attachment.table_name}.*",
:joins => "LEFT JOIN #{Version.table_name} ON #{Attachment.table_name}.container_type='Version' AND #{Version.table_name}.id = #{Attachment.table_name}.container_id " +
- "LEFT JOIN #{Project.table_name} ON #{Version.table_name}.project_id = #{Project.table_name}.id"}
+ "LEFT JOIN #{Project.table_name} ON #{Version.table_name}.project_id = #{Project.table_name}.id OR ( #{Attachment.table_name}.container_type='Project' AND #{Attachment.table_name}.container_id = #{Project.table_name}.id )"}
acts_as_activity_provider :type => 'documents',
:permission => :view_documents,
diff --git a/app/models/query.rb b/app/models/query.rb
index 1a4845975..f3dedf04d 100644
--- a/app/models/query.rb
+++ b/app/models/query.rb
@@ -93,6 +93,7 @@ class Query < ActiveRecord::Base
cattr_reader :operators_by_filter_type
@@available_columns = [
+ QueryColumn.new(:project, :sortable => "#{Project.table_name}.name"),
QueryColumn.new(:tracker, :sortable => "#{Tracker.table_name}.position"),
QueryColumn.new(:status, :sortable => "#{IssueStatus.table_name}.position"),
QueryColumn.new(:priority, :sortable => "#{Enumeration.table_name}.position", :default_order => 'desc'),
@@ -234,7 +235,10 @@ class Query < ActiveRecord::Base
def columns
if has_default_columns?
- available_columns.select {|c| Setting.issue_list_default_columns.include?(c.name.to_s) }
+ available_columns.select do |c|
+ # Adds the project column by default for cross-project lists
+ Setting.issue_list_default_columns.include?(c.name.to_s) || (c.name == :project && project.nil?)
+ end
else
# preserve the column_names order
column_names.collect {|name| available_columns.find {|col| col.name == name}}.compact
diff --git a/app/models/repository/subversion.rb b/app/models/repository/subversion.rb
index 9515e6b76..d97528ee7 100644
--- a/app/models/repository/subversion.rb
+++ b/app/models/repository/subversion.rb
@@ -54,8 +54,8 @@ class Repository::Subversion < Repository
# loads changesets by batches of 200
identifier_to = [identifier_from + 199, scm_revision].min
revisions = scm.revisions('', identifier_to, identifier_from, :with_paths => true)
- transaction do
- revisions.reverse_each do |revision|
+ revisions.reverse_each do |revision|
+ transaction do
changeset = Changeset.create(:repository => self,
:revision => revision.identifier,
:committer => revision.author,
@@ -68,7 +68,7 @@ class Repository::Subversion < Repository
:path => change[:path],
:from_path => change[:from_path],
:from_revision => change[:from_revision])
- end
+ end unless changeset.new_record?
end
end unless revisions.nil?
identifier_from = identifier_to + 1