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

use less conflicting namespace

ulfertsc1e84620c0a4
diff --git a/app/models/queries/operators/this_week.rb b/app/models/queries/operators/this_week.rb
index ad95b78d533..15eaedcca32 100644
--- a/app/models/queries/operators/this_week.rb
+++ b/app/models/queries/operators/this_week.rb
@@ -33,7 +33,7 @@ module Queries::Operators
require_value false
def self.sql_for_field(_values, db_table, db_field)
- from = OpenProject::I18n::Date.time_at_beginning_of_week
+ from = OpenProject::Internationalization::Date.time_at_beginning_of_week
"#{db_table}.#{db_field} BETWEEN '%s' AND '%s'" % [
connection.quoted_date(from), connection.quoted_date(from + 7.days)
]
diff --git a/app/models/queries/projects/filters/any_stage_or_gate_filter.rb b/app/models/queries/projects/filters/any_stage_or_gate_filter.rb
index 7596214cea3..b9359298a58 100644
--- a/app/models/queries/projects/filters/any_stage_or_gate_filter.rb
+++ b/app/models/queries/projects/filters/any_stage_or_gate_filter.rb
@@ -152,7 +152,7 @@ class Queries::Projects::Filters::AnyStageOrGateFilter < Queries::Projects::Filt
end
def beginning_of_week
- OpenProject::I18n::Date.time_at_beginning_of_week
+ OpenProject::Internationalization::Date.time_at_beginning_of_week
end
def end_of_week
diff --git a/lib/open_project/i18n/date.rb b/lib/open_project/internationalization/date.rb
similarity index 90%
rename from lib/open_project/i18n/date.rb
rename to lib/open_project/internationalization/date.rb
index 3fb263e55c3..e6e4f9d9f6c 100644
--- a/lib/open_project/i18n/date.rb
+++ b/lib/open_project/internationalization/date.rb
@@ -28,8 +28,11 @@
# See COPYRIGHT and LICENSE files for more details.
# ++
+# The module is not called I18n as that leads to tons of conflicts
+# where I18n is called within the OpenProject module and rails I18n is meant.
+
module OpenProject
- module I18n
+ module Internationalization
module Date
module_function
diff --git a/lib_static/redmine/i18n.rb b/lib_static/redmine/i18n.rb
index 443574ed2a3..e13137cb4a4 100644
--- a/lib_static/redmine/i18n.rb
+++ b/lib_static/redmine/i18n.rb
@@ -27,7 +27,7 @@
#++
# This file is to be split up into smaller files in the OpenProject namespace.
-# A start has been made by splitting off OpenProject::I18n::Date into its own file.
+# A start has been made by splitting off OpenProject::Internationalization::Date into its own file.
module Redmine
module I18n
diff --git a/modules/meeting/app/controllers/meetings_controller.rb b/modules/meeting/app/controllers/meetings_controller.rb
index f0d13e1bf4b..1421b33fa49 100644
--- a/modules/meeting/app/controllers/meetings_controller.rb
+++ b/modules/meeting/app/controllers/meetings_controller.rb
@@ -372,7 +372,7 @@ class MeetingsController < ApplicationController
def group_meetings(all_meetings) # rubocop:disable Metrics/AbcSize
next_week = Time
.current
- .next_occurring(OpenProject::I18n::Date.beginning_of_week)
+ .next_occurring(OpenProject::Internationalization::Date.beginning_of_week)
.beginning_of_day
groups = Hash.new { |h, k| h[k] = [] }
groups[:later] = show_more_pagination(all_meetings
diff --git a/modules/meeting/spec/requests/meetings_index_spec.rb b/modules/meeting/spec/requests/meetings_index_spec.rb
index 098bee5a638..ed4786a3072 100644
--- a/modules/meeting/spec/requests/meetings_index_spec.rb
+++ b/modules/meeting/spec/requests/meetings_index_spec.rb
@@ -185,7 +185,7 @@ RSpec.describe "Meeting index",
end
describe "with start_of_week on sunday",
- with_settings: { start_of_week: 7 } do
+ with_settings: { start_of_week: 0 } do
it "sorts upcoming meetings into buckets" do
expect(subject).to have_http_status(:ok)
@@ -261,7 +261,7 @@ RSpec.describe "Meeting index",
end
end
- describe "paginating options" do
+ describe "paginating options", with_settings: { start_of_week: 1 } do
context "when requesting the first page with limit=1" do
let(:request) { get "/projects/#{project.id}/meetings?limit=1" }
diff --git a/modules/meeting/spec/support/pages/meetings/index.rb b/modules/meeting/spec/support/pages/meetings/index.rb
index 227825732bd..c07630eafe7 100644
--- a/modules/meeting/spec/support/pages/meetings/index.rb
+++ b/modules/meeting/spec/support/pages/meetings/index.rb
@@ -193,7 +193,7 @@ module Pages::Meetings
def meeting_group_key(meeting)
start_date = meeting.start_time.to_date
- next_week = Time.current.next_occurring(OpenProject::I18n::Date.beginning_of_week)
+ next_week = Time.current.next_occurring(OpenProject::Internationalization::Date.beginning_of_week)
if start_date == Time.zone.today
:today
diff --git a/spec/lib/open_project/i18n/date_spec.rb b/spec/lib/open_project/internationalization/date_spec.rb
similarity index 99%
rename from spec/lib/open_project/i18n/date_spec.rb
rename to spec/lib/open_project/internationalization/date_spec.rb
index d3d75b4ef89..6fd49582e45 100644
--- a/spec/lib/open_project/i18n/date_spec.rb
+++ b/spec/lib/open_project/internationalization/date_spec.rb
@@ -30,7 +30,7 @@
require "spec_helper"
-RSpec.describe OpenProject::I18n::Date do
+RSpec.describe OpenProject::Internationalization::Date do
describe ".beginning_of_week" do
context "when the first day of the week is Sunday", with_settings: { start_of_week: 7 } do
it "returns :sunday" do