Redmine 4.1.7

This commit is contained in:
Manuel Cillero 2023-07-07 08:08:27 +02:00
parent 55458d3479
commit 3ca3c37487
103 changed files with 2426 additions and 431 deletions

View file

@ -107,7 +107,7 @@ module Redmine
end
next unless a
a.description = attachment['description'].to_s.strip
if a.new_record?
if a.new_record? || a.invalid?
unsaved_attachments << a
else
saved_attachments << a

View file

@ -74,7 +74,7 @@ module Redmine
all.each do |object|
clear = object.send(attribute)
object.send "#{attribute}=", clear
raise(ActiveRecord::Rollback) unless object.save(:validation => false)
raise(ActiveRecord::Rollback) unless object.save(validate: false)
end
end ? true : false
end
@ -84,7 +84,7 @@ module Redmine
all.each do |object|
clear = object.send(attribute)
object.send :write_attribute, attribute, clear
raise(ActiveRecord::Rollback) unless object.save(:validation => false)
raise(ActiveRecord::Rollback) unless object.save(validate: false)
end
end ? true : false
end

View file

@ -341,6 +341,7 @@ module Redmine
if options[:format] == :html
data_options = {}
data_options[:collapse_expand] = "issue-#{issue.id}"
data_options[:number_of_rows] = number_of_rows
style = "position: absolute;top: #{options[:top]}px; font-size: 0.8em;"
content = view.content_tag(:div, view.column_content(options[:column], issue), :style => style, :class => "issue_#{options[:column].name}", :id => "#{options[:column].name}_issue_#{issue.id}", :data => data_options)
@columns[options[:column].name] << content if @columns.has_key?(options[:column].name)
@ -378,6 +379,9 @@ module Redmine
unless Redmine::Configuration['rmagick_font_path'].nil?
font_path = Redmine::Configuration['minimagick_font_path'].presence || Redmine::Configuration['rmagick_font_path'].presence
img = MiniMagick::Image.create(".#{format}", false)
if Redmine::Configuration['imagemagick_convert_command'].present?
MiniMagick.cli_path = File.dirname(Redmine::Configuration['imagemagick_convert_command'])
end
MiniMagick::Tool::Convert.new do |gc|
gc.size('%dx%d' % [subject_width + g_width + 1, height])
gc.xc('white')
@ -623,14 +627,14 @@ module Redmine
def coordinates(start_date, end_date, progress, zoom=nil)
zoom ||= @zoom
coords = {}
if start_date && end_date && start_date < self.date_to && end_date > self.date_from
if start_date > self.date_from
if start_date && end_date && start_date <= self.date_to && end_date >= self.date_from
if start_date >= self.date_from
coords[:start] = start_date - self.date_from
coords[:bar_start] = start_date - self.date_from
else
coords[:bar_start] = 0
end
if end_date < self.date_to
if end_date <= self.date_to
coords[:end] = end_date - self.date_from + 1
coords[:bar_end] = end_date - self.date_from + 1
else
@ -768,6 +772,7 @@ module Redmine
:top_increment => params[:top_increment],
:obj_id => "#{object.class}-#{object.id}".downcase,
},
:number_of_rows => number_of_rows,
}
end
if has_children
@ -823,7 +828,10 @@ module Redmine
def html_task(params, coords, markers, label, object)
output = +''
data_options = {}
data_options[:collapse_expand] = "#{object.class}-#{object.id}".downcase if object
if object
data_options[:collapse_expand] = "#{object.class}-#{object.id}".downcase
data_options[:number_of_rows] = number_of_rows
end
css = "task " +
case object
when Project

View file

@ -35,6 +35,7 @@ module Redmine
projects = projects.like(query)
end
projects.
visible.
index_by(&:id).
values_at(*project_ids). # sort according to stored order
compact

View file

@ -178,6 +178,14 @@ module Redmine
(path[-1,1] == "/") ? path[0..-2] : path
end
def valid_name?(name)
return true if name.nil?
return true if name.is_a?(Integer) && name > 0
return true if name.is_a?(String) && name =~ /\A[0-9]*\z/
false
end
private
def retrieve_root_url

View file

@ -388,6 +388,18 @@ module Redmine
nil
end
def valid_name?(name)
return false unless name.is_a?(String)
return false if name.start_with?('-', '/', 'refs/heads/', 'refs/remotes/')
return false if name == 'HEAD'
git_cmd ['show-ref', '--heads', '--tags', '--quiet', '--', name]
true
rescue ScmCommandAborted
false
end
class Revision < Redmine::Scm::Adapters::Revision
# Returns the readable identifier
def format_identifier

View file

@ -291,6 +291,15 @@ module Redmine
Annotate.new
end
def valid_name?(name)
return false unless name.nil? || name.is_a?(String)
# Mercurials names don't need to be checked further as its CLI
# interface is restrictive enough to reject any invalid names on its
# own.
true
end
class Revision < Redmine::Scm::Adapters::Revision
# Returns the readable identifier
def format_identifier

View file

@ -18,7 +18,6 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
require 'fileutils'
require 'mimemagic'
module Redmine
module Thumbnail
@ -33,15 +32,11 @@ module Redmine
return nil unless convert_available?
return nil if is_pdf && !gs_available?
unless File.exists?(target)
mime_type = File.open(source) {|f| MimeMagic.by_magic(f).try(:type) }
return nil if mime_type.nil?
# Make sure we only invoke Imagemagick if the file type is allowed
mime_type = File.open(source) {|f| Marcel::MimeType.for(f)}
return nil if !ALLOWED_TYPES.include? mime_type
return nil if is_pdf && mime_type != "application/pdf"
# Make sure we only invoke Imagemagick if the file type is allowed
unless File.open(source) {|f| ALLOWED_TYPES.include? MimeMagic.by_magic(f).try(:type) }
return nil
end
directory = File.dirname(target)
unless File.exists?(directory)
FileUtils.mkdir_p directory

View file

@ -7,7 +7,7 @@ module Redmine
module VERSION
MAJOR = 4
MINOR = 1
TINY = 1
TINY = 7
# Branch values:
# * official release: nil

View file

@ -2,7 +2,6 @@ desc 'Load Redmine default configuration data. Language is chosen interactively
namespace :redmine do
task :load_default_data => :environment do
require 'custom_field'
include Redmine::I18n
set_language_if_valid('en')