Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

bump rails

ulferts9d146cde03ff
diff --git a/Gemfile.lock b/Gemfile.lock
index c18d93fc3a8..ff44b3a77fa 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -188,34 +188,34 @@ GEM
remote: https://rubygems.org/
specs:
Ascii85 (1.1.0)
- actioncable (7.0.3.1)
- actionpack (= 7.0.3.1)
- activesupport (= 7.0.3.1)
+ actioncable (7.0.4)
+ actionpack (= 7.0.4)
+ activesupport (= 7.0.4)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
- actionmailbox (7.0.3.1)
- actionpack (= 7.0.3.1)
- activejob (= 7.0.3.1)
- activerecord (= 7.0.3.1)
- activestorage (= 7.0.3.1)
- activesupport (= 7.0.3.1)
+ actionmailbox (7.0.4)
+ actionpack (= 7.0.4)
+ activejob (= 7.0.4)
+ activerecord (= 7.0.4)
+ activestorage (= 7.0.4)
+ activesupport (= 7.0.4)
mail (>= 2.7.1)
net-imap
net-pop
net-smtp
- actionmailer (7.0.3.1)
- actionpack (= 7.0.3.1)
- actionview (= 7.0.3.1)
- activejob (= 7.0.3.1)
- activesupport (= 7.0.3.1)
+ actionmailer (7.0.4)
+ actionpack (= 7.0.4)
+ actionview (= 7.0.4)
+ activejob (= 7.0.4)
+ activesupport (= 7.0.4)
mail (~> 2.5, >= 2.5.4)
net-imap
net-pop
net-smtp
rails-dom-testing (~> 2.0)
- actionpack (7.0.3.1)
- actionview (= 7.0.3.1)
- activesupport (= 7.0.3.1)
+ actionpack (7.0.4)
+ actionview (= 7.0.4)
+ activesupport (= 7.0.4)
rack (~> 2.0, >= 2.2.0)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
@@ -223,31 +223,31 @@ GEM
actionpack-xml_parser (2.0.1)
actionpack (>= 5.0)
railties (>= 5.0)
- actiontext (7.0.3.1)
- actionpack (= 7.0.3.1)
- activerecord (= 7.0.3.1)
- activestorage (= 7.0.3.1)
- activesupport (= 7.0.3.1)
+ actiontext (7.0.4)
+ actionpack (= 7.0.4)
+ activerecord (= 7.0.4)
+ activestorage (= 7.0.4)
+ activesupport (= 7.0.4)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
- actionview (7.0.3.1)
- activesupport (= 7.0.3.1)
+ actionview (7.0.4)
+ activesupport (= 7.0.4)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
- activejob (7.0.3.1)
- activesupport (= 7.0.3.1)
+ activejob (7.0.4)
+ activesupport (= 7.0.4)
globalid (>= 0.3.6)
- activemodel (7.0.3.1)
- activesupport (= 7.0.3.1)
+ activemodel (7.0.4)
+ activesupport (= 7.0.4)
activemodel-serializers-xml (1.0.2)
activemodel (> 5.x)
activesupport (> 5.x)
builder (~> 3.1)
- activerecord (7.0.3.1)
- activemodel (= 7.0.3.1)
- activesupport (= 7.0.3.1)
+ activerecord (7.0.4)
+ activemodel (= 7.0.4)
+ activesupport (= 7.0.4)
activerecord-import (1.4.0)
activerecord (>= 4.2)
activerecord-nulldb-adapter (0.8.0)
@@ -258,14 +258,14 @@ GEM
multi_json (~> 1.11, >= 1.11.2)
rack (>= 2.0.8, < 3)
railties (>= 5.2.4.1)
- activestorage (7.0.3.1)
- actionpack (= 7.0.3.1)
- activejob (= 7.0.3.1)
- activerecord (= 7.0.3.1)
- activesupport (= 7.0.3.1)
+ activestorage (7.0.4)
+ actionpack (= 7.0.4)
+ activejob (= 7.0.4)
+ activerecord (= 7.0.4)
+ activesupport (= 7.0.4)
marcel (~> 1.0)
mini_mime (>= 1.1.0)
- activesupport (7.0.3.1)
+ activesupport (7.0.4)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
@@ -767,20 +767,20 @@ GEM
rack_session_access (0.2.0)
builder (>= 2.0.0)
rack (>= 1.0.0)
- rails (7.0.3.1)
- actioncable (= 7.0.3.1)
- actionmailbox (= 7.0.3.1)
- actionmailer (= 7.0.3.1)
- actionpack (= 7.0.3.1)
- actiontext (= 7.0.3.1)
- actionview (= 7.0.3.1)
- activejob (= 7.0.3.1)
- activemodel (= 7.0.3.1)
- activerecord (= 7.0.3.1)
- activestorage (= 7.0.3.1)
- activesupport (= 7.0.3.1)
+ rails (7.0.4)
+ actioncable (= 7.0.4)
+ actionmailbox (= 7.0.4)
+ actionmailer (= 7.0.4)
+ actionpack (= 7.0.4)
+ actiontext (= 7.0.4)
+ actionview (= 7.0.4)
+ activejob (= 7.0.4)
+ activemodel (= 7.0.4)
+ activerecord (= 7.0.4)
+ activestorage (= 7.0.4)
+ activesupport (= 7.0.4)
bundler (>= 1.15.0)
- railties (= 7.0.3.1)
+ railties (= 7.0.4)
rails-controller-testing (1.0.5)
actionpack (>= 5.0.1.rc1)
actionview (>= 5.0.1.rc1)
@@ -793,9 +793,9 @@ GEM
rails-i18n (7.0.5)
i18n (>= 0.7, < 2)
railties (>= 6.0.0, < 8)
- railties (7.0.3.1)
- actionpack (= 7.0.3.1)
- activesupport (= 7.0.3.1)
+ railties (7.0.4)
+ actionpack (= 7.0.4)
+ activesupport (= 7.0.4)
method_source
rake (>= 12.2)
thor (~> 1.0)
diff --git a/app/models/mail_handler.rb b/app/models/mail_handler.rb
index 2d36b6207c6..91e37934878 100644
--- a/app/models/mail_handler.rb
+++ b/app/models/mail_handler.rb
@@ -338,18 +338,31 @@ class MailHandler < ActionMailer::Base
# Destructively extracts the value for +attr+ in +text+
# Returns nil if no matching keyword found
- def extract_keyword!(text, attr, format = nil)
+ def extract_keyword!(text, attr, format)
+ keys = human_attr_translations(attr)
+ .compact_blank
+ .uniq
+ .map { |k| Regexp.escape(k) }
+
+ value = nil
+
+ text.gsub!(/^(#{keys.join('|')})[ \t]*:[ \t]*(?<value>#{format || '.+'})\s*$/i) do |_|
+ value = Regexp.last_match[:value]&.strip
+
+ ''
+ end
+
+ value
+ end
+
+ def human_attr_translations(attr)
keys = [attr.to_s.humanize]
- keys << all_attribute_translations(user.language)[attr] if user && user.language.present?
- keys << all_attribute_translations(Setting.default_language)[attr] if Setting.default_language.present?
- keys.reject!(&:blank?)
- keys.map! do |k|
- Regexp.escape(k)
+ [user&.language, Setting.default_language].compact_blank.each do |lang|
+ keys << all_attribute_translations(lang)[attr]
end
- format ||= '.+'
- text.gsub!(/^(#{keys.join('|')})[ \t]*:[ \t]*(#{format})\s*$/i, '')
- $2&.strip
+
+ keys
end
def target_project
@@ -376,7 +389,7 @@ class MailHandler < ActionMailer::Base
'due_date' => wp_due_date_from_keywords,
'estimated_hours' => wp_estimated_hours_from_keywords,
'done_ratio' => wp_done_ratio_from_keyword
- }.delete_if { |_, v| v.blank? }
+ }.compact_blank!
end
# Returns a Hash of issue custom field values extracted from keywords in the email body
@@ -476,7 +489,7 @@ class MailHandler < ActionMailer::Base
# Removes the email body of text after the truncation configurations.
def cleanup_body(body)
- delimiters = Setting.mail_handler_body_delimiters.to_s.split(/[\r\n]+/).reject(&:blank?).map { |s| Regexp.escape(s) }
+ delimiters = Setting.mail_handler_body_delimiters.to_s.split(/[\r\n]+/).compact_blank.map { |s| Regexp.escape(s) }
unless delimiters.empty?
regex = Regexp.new("^[> ]*(#{delimiters.join('|')})\s*[\r\n].*", Regexp::MULTILINE)
body = body.gsub(regex, '')
@@ -492,7 +505,7 @@ class MailHandler < ActionMailer::Base
end
def ignored_filenames
- @ignored_filenames ||= Setting.mail_handler_ignore_filenames.to_s.split(/[\r\n]+/).reject(&:blank?)
+ @ignored_filenames ||= Setting.mail_handler_ignore_filenames.to_s.split(/[\r\n]+/).compact_blank
end
def ignored_filename?(filename)