Redmine 4.1.1
This commit is contained in:
parent
33e7b881a5
commit
3d976f1b3b
1593 changed files with 36180 additions and 19489 deletions
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Loads the core plugins located in lib/plugins
|
||||
Dir.glob(File.join(Rails.root, "lib/plugins/*")).sort.each do |directory|
|
||||
if File.directory?(directory)
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'active_record'
|
||||
|
||||
module ActiveRecord
|
||||
|
@ -6,7 +8,7 @@ module ActiveRecord
|
|||
# Translate attribute names for validation errors display
|
||||
def self.human_attribute_name(attr, options = {})
|
||||
prepared_attr = attr.to_s.sub(/_id$/, '').sub(/^.+\./, '')
|
||||
class_prefix = name.underscore.gsub('/', '_')
|
||||
class_prefix = name.underscore.tr('/', '_')
|
||||
|
||||
redmine_default = [
|
||||
:"field_#{class_prefix}_#{prepared_attr}",
|
||||
|
@ -95,7 +97,7 @@ module ActionView
|
|||
alias :options_for_select_without_non_empty_blank_option :options_for_select
|
||||
def options_for_select(container, selected = nil)
|
||||
if container.is_a?(Array)
|
||||
container = container.map {|element| element.blank? ? [" ".html_safe, ""] : element}
|
||||
container = container.map {|element| element.presence || [" ".html_safe, ""]}
|
||||
end
|
||||
options_for_select_without_non_empty_blank_option(container, selected)
|
||||
end
|
||||
|
@ -106,35 +108,18 @@ end
|
|||
require 'mail'
|
||||
|
||||
module DeliveryMethods
|
||||
class AsyncSMTP < ::Mail::SMTP
|
||||
def deliver!(*args)
|
||||
Thread.start do
|
||||
super *args
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class AsyncSendmail < ::Mail::Sendmail
|
||||
def deliver!(*args)
|
||||
Thread.start do
|
||||
super *args
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class TmpFile
|
||||
def initialize(*args); end
|
||||
|
||||
def deliver!(mail)
|
||||
dest_dir = File.join(Rails.root, 'tmp', 'emails')
|
||||
Dir.mkdir(dest_dir) unless File.directory?(dest_dir)
|
||||
File.open(File.join(dest_dir, mail.message_id.gsub(/[<>]/, '') + '.eml'), 'wb') {|f| f.write(mail.encoded) }
|
||||
filename = "#{Time.now.to_i}_#{mail.message_id.gsub(/[<>]/, '')}.eml"
|
||||
File.open(File.join(dest_dir, filename), 'wb') {|f| f.write(mail.encoded) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
ActionMailer::Base.add_delivery_method :async_smtp, DeliveryMethods::AsyncSMTP
|
||||
ActionMailer::Base.add_delivery_method :async_sendmail, DeliveryMethods::AsyncSendmail
|
||||
ActionMailer::Base.add_delivery_method :tmp_file, DeliveryMethods::TmpFile
|
||||
|
||||
# Changes how sent emails are logged
|
||||
|
@ -142,7 +127,7 @@ ActionMailer::Base.add_delivery_method :tmp_file, DeliveryMethods::TmpFile
|
|||
module ActionMailer
|
||||
class LogSubscriber < ActiveSupport::LogSubscriber
|
||||
def deliver(event)
|
||||
recipients = [:to, :cc, :bcc].inject("") do |s, header|
|
||||
recipients = [:to, :cc, :bcc].inject(+"") do |s, header|
|
||||
r = Array.wrap(event.payload[header])
|
||||
if r.any?
|
||||
s << "\n #{header}: #{r.join(', ')}"
|
||||
|
@ -155,16 +140,6 @@ module ActionMailer
|
|||
end
|
||||
end
|
||||
|
||||
# #deliver is deprecated in Rails 4.2
|
||||
# Prevents massive deprecation warnings
|
||||
module ActionMailer
|
||||
class MessageDelivery < Delegator
|
||||
def deliver
|
||||
deliver_now
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
module ActionController
|
||||
module MimeResponds
|
||||
class Collector
|
||||
|
@ -201,7 +176,7 @@ module ActionView
|
|||
unless asset_id.blank?
|
||||
source += "?#{asset_id}"
|
||||
end
|
||||
asset_path(source, options)
|
||||
asset_path(source, options.merge(skip_pipeline: true))
|
||||
end
|
||||
alias :path_to_asset :asset_path_with_asset_id
|
||||
|
||||
|
@ -218,7 +193,7 @@ module ActionView
|
|||
if File.exist? path
|
||||
exist = true
|
||||
else
|
||||
path = File.join(Rails.public_path, compute_asset_path("#{source}#{extname}", options))
|
||||
path = File.join(Rails.public_path, public_compute_asset_path("#{source}#{extname}", options))
|
||||
if File.exist? path
|
||||
exist = true
|
||||
end
|
||||
|
@ -237,4 +212,4 @@ module ActionView
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Add new mime types for use in respond_to blocks:
|
||||
|
||||
Mime::SET << Mime::CSV unless Mime::SET.include?(Mime::CSV)
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
I18n.default_locale = 'en'
|
||||
# frozen_string_literal: true
|
||||
|
||||
I18n.backend = Redmine::I18n::Backend.new
|
||||
# Forces I18n to load available locales from the backend
|
||||
I18n.config.available_locales = nil
|
||||
|
@ -13,18 +14,27 @@ end
|
|||
|
||||
if Object.const_defined?(:OpenIdAuthentication)
|
||||
openid_authentication_store = Redmine::Configuration['openid_authentication_store']
|
||||
OpenIdAuthentication.store =
|
||||
openid_authentication_store.present? ?
|
||||
openid_authentication_store : :memory
|
||||
OpenIdAuthentication.store = openid_authentication_store.presence || :memory
|
||||
end
|
||||
|
||||
Redmine::Plugin.load
|
||||
unless Redmine::Configuration['mirror_plugins_assets_on_startup'] == false
|
||||
|
||||
plugin_assets_dirs = {}
|
||||
Redmine::Plugin.all.each do |plugin|
|
||||
plugin_assets_dirs[plugin.assets_directory] = ["*"]
|
||||
end
|
||||
plugin_assets_reloader = ActiveSupport::FileUpdateChecker.new([], plugin_assets_dirs) do
|
||||
Redmine::Plugin.mirror_assets
|
||||
end
|
||||
Rails.application.reloaders << plugin_assets_reloader
|
||||
unless Redmine::Configuration['mirror_plugins_assets_on_startup'] == false
|
||||
plugin_assets_reloader.execute
|
||||
end
|
||||
|
||||
Rails.application.config.to_prepare do
|
||||
Redmine::FieldFormat::RecordList.subclasses.each do |klass|
|
||||
klass.instance.reset_target_class
|
||||
end
|
||||
|
||||
plugin_assets_reloader.execute_if_updated
|
||||
end
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# Add new inflection rules using the following format
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue