summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/redmine.rb5
-rw-r--r--lib/redmine/helpers/gantt.rb24
-rw-r--r--lib/redmine/preparation.rb4
3 files changed, 18 insertions, 15 deletions
diff --git a/lib/redmine.rb b/lib/redmine.rb
index 95b3b7f3f..78a1a6d8c 100644
--- a/lib/redmine.rb
+++ b/lib/redmine.rb
@@ -24,11 +24,6 @@ begin
rescue LoadError
# MiniMagick is not available
end
-begin
- require 'commonmarker' unless Object.const_defined?(:Commonmarker)
-rescue LoadError
- # CommonMarker is not available
-end
module Redmine
end
diff --git a/lib/redmine/helpers/gantt.rb b/lib/redmine/helpers/gantt.rb
index 5854a15f2..523ae3188 100644
--- a/lib/redmine/helpers/gantt.rb
+++ b/lib/redmine/helpers/gantt.rb
@@ -198,12 +198,18 @@ module Redmine
# Returns the distinct versions of the issues that belong to +project+
def project_versions(project)
- project_issues(project).filter_map(&:fixed_version).uniq
+ @project_versions ||= {}
+ @project_versions[project&.id] ||= begin
+ ids = project_issues(project).filter_map(&:fixed_version_id).uniq
+ Version.where(id: ids).to_a
+ end
end
# Returns the issues that belong to +project+ and are assigned to +version+
def version_issues(project, version)
- project_issues(project).select {|issue| issue.fixed_version == version}
+ @version_issues ||= {}
+ @version_issues[[project&.id, version&.id]] ||=
+ project_issues(project).select {|issue| issue.fixed_version_id == version&.id}
end
def render(options={})
@@ -232,7 +238,7 @@ module Redmine
render_object_row(project, options)
increment_indent(options) do
# render issue that are not assigned to a version
- issues = project_issues(project).select {|i| i.fixed_version.nil?}
+ issues = project_issues(project).select {|i| i.fixed_version_id.nil?}
render_issues(issues, options)
# then render project versions and their issues
versions = project_versions(project)
@@ -748,7 +754,7 @@ module Redmine
html_class << (version.behind_schedule? ? 'version-behind-schedule' : '') << " "
html_class << (version.overdue? ? 'version-overdue' : '')
html_class << ' version-closed' unless version.open?
- if version.start_date && version.due_date && version.visible_fixed_issues.completed_percent
+ if version.due_date && version.start_date && version.visible_fixed_issues.completed_percent
progress_date = calc_progress_date(version.start_date,
version.due_date, version.visible_fixed_issues.completed_percent)
html_class << ' behind-start-date' if progress_date < self.date_from
@@ -778,10 +784,14 @@ module Redmine
tag_options[:id] = "issue-#{object.id}"
tag_options[:class] = "issue-subject hascontextmenu"
tag_options[:title] = object.subject
- children = object.leaf? ? [] : object.children & project_issues(object.project)
has_children =
- children.present? &&
- children.collect(&:fixed_version).uniq.intersect?([object.fixed_version])
+ if object.leaf?
+ false
+ else
+ children = object.children & project_issues(object.project)
+ fixed_version_id = object.fixed_version_id
+ children.any? {|child| child.fixed_version_id == fixed_version_id}
+ end
when Version
tag_options[:id] = "version-#{object.id}"
tag_options[:class] = "version-name"
diff --git a/lib/redmine/preparation.rb b/lib/redmine/preparation.rb
index 822662e11..a31204904 100644
--- a/lib/redmine/preparation.rb
+++ b/lib/redmine/preparation.rb
@@ -408,9 +408,7 @@ module Redmine
WikiFormatting.map do |format|
format.register :textile
- if Object.const_defined?(:Commonmarker)
- format.register :common_mark, label: 'CommonMark Markdown (GitHub Flavored)'
- end
+ format.register :common_mark, label: 'CommonMark Markdown (GitHub Flavored)'
end
ActionView::Template.register_template_handler :rsb, Views::ApiTemplateHandler