diff options
author | Aleksei Lipniagov <alipniagov@gitlab.com> | 2019-09-11 21:32:24 +0300 |
---|---|---|
committer | Kamil TrzciĆski <ayufan@ayufan.eu> | 2019-09-11 21:32:24 +0300 |
commit | 50cb6eca570a352a3b9799a66f77edad261763be (patch) | |
tree | d5157634a5100ca6900a3dc8d7b0b806caf39ca5 /lib/gitlab/patch | |
parent | 6db9cbfe77a556ea2d321f0ea0a0c6b6e14a817c (diff) |
Use 'gitlab_chronic_duration' gem
Replace 'chronic_duration' to 'gitlab_chronic_duration', to make
relevant method calls thread-safe.
Diffstat (limited to 'lib/gitlab/patch')
-rw-r--r-- | lib/gitlab/patch/chronic_duration.rb | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/lib/gitlab/patch/chronic_duration.rb b/lib/gitlab/patch/chronic_duration.rb deleted file mode 100644 index ab3cba3657f..00000000000 --- a/lib/gitlab/patch/chronic_duration.rb +++ /dev/null @@ -1,35 +0,0 @@ -# frozen_string_literal: true - -# Fixes a bug where parsing months doesn't take into account -# the ChronicDuration.days_per_week setting -# -# We can remove this when we do a refactor and push upstream in -# https://gitlab.com/gitlab-org/gitlab-ce/issues/66637 - -module Gitlab - module Patch - module ChronicDuration - extend ActiveSupport::Concern - - class_methods do - def duration_units_seconds_multiplier(unit) - return 0 unless duration_units_list.include?(unit) - - case unit - when 'months' - 3600 * ::ChronicDuration.hours_per_day * ::ChronicDuration.days_per_month - else - super - end - end - - # ChronicDuration#output uses 1mo = 4w as the conversion so we do the same here. - # We do need to add a special case for the default days_per_week value because - # we want to retain existing behavior for the default case - def days_per_month - ::ChronicDuration.days_per_week == 7 ? 30 : ::ChronicDuration.days_per_week * 4 - end - end - end - end -end |