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

move to proper module

ulferts3b0f7367fd35
diff --git a/app/contracts/work_packages/base_contract.rb b/app/contracts/work_packages/base_contract.rb
index a5142780a03..6d4ef5981d1 100644
--- a/app/contracts/work_packages/base_contract.rb
+++ b/app/contracts/work_packages/base_contract.rb
@@ -208,7 +208,7 @@ module WorkPackages
end
def validate_assigned_to_exists
- errors.add :assigned_to, :does_not_exist if model.assigned_to&.is_a?(User::InexistentUser)
+ errors.add :assigned_to, :does_not_exist if model.assigned_to&.is_a?(Users::InexistentUser)
end
def validate_type_exists
diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb
index 9fe8025cad3..75b7fd84864 100644
--- a/app/helpers/users_helper.rb
+++ b/app/helpers/users_helper.rb
@@ -35,7 +35,7 @@ module UsersHelper
# @param extra [Hash] A hash containing extra entries with a count for each.
# For example: { random: 42 }
def users_status_options_for_select(selected, extra: {})
- statuses = User::StatusOptions.user_statuses_with_count extra: extra
+ statuses = Users::StatusOptions.user_statuses_with_count extra: extra
options = statuses.map do |sym, count|
["#{translate_user_status(sym)} (#{count})", sym]
diff --git a/app/models/user.rb b/app/models/user.rb
index 4973b627d18..a16dd216ff0 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -207,7 +207,7 @@ class User < Principal
@name = nil
@projects_by_role = nil
@authorization_service = ::Authorization::UserAllowedService.new(self)
- @project_role_cache = ::User::ProjectRoleCache.new(self)
+ @project_role_cache = ::Users::ProjectRoleCache.new(self)
super
end
@@ -776,7 +776,7 @@ class User < Principal
end
def project_role_cache
- @project_role_cache ||= ::User::ProjectRoleCache.new(self)
+ @project_role_cache ||= ::Users::ProjectRoleCache.new(self)
end
def former_passwords_include?(password)
diff --git a/app/models/user/inexistent_user.rb b/app/models/users/inexistent_user.rb
similarity index 96%
rename from app/models/user/inexistent_user.rb
rename to app/models/users/inexistent_user.rb
index 85c95b2c3b1..e6b253396b9 100644
--- a/app/models/user/inexistent_user.rb
+++ b/app/models/users/inexistent_user.rb
@@ -28,4 +28,4 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
-class User::InexistentUser < User; end
+class Users::InexistentUser < User; end
diff --git a/app/models/user/project_authorization_cache.rb b/app/models/users/project_authorization_cache.rb
similarity index 98%
rename from app/models/user/project_authorization_cache.rb
rename to app/models/users/project_authorization_cache.rb
index 037a202eb0b..c52f066b591 100644
--- a/app/models/user/project_authorization_cache.rb
+++ b/app/models/users/project_authorization_cache.rb
@@ -28,7 +28,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
-class User::ProjectAuthorizationCache
+class Users::ProjectAuthorizationCache
attr_accessor :user
def initialize(user)
diff --git a/app/models/user/project_role_cache.rb b/app/models/users/project_role_cache.rb
similarity index 98%
rename from app/models/user/project_role_cache.rb
rename to app/models/users/project_role_cache.rb
index 58ff7a3ba79..270165af2e2 100644
--- a/app/models/user/project_role_cache.rb
+++ b/app/models/users/project_role_cache.rb
@@ -28,7 +28,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
-class User::ProjectRoleCache
+class Users::ProjectRoleCache
attr_accessor :user
def initialize(user)
diff --git a/app/models/user/status_options.rb b/app/models/users/status_options.rb
similarity index 99%
rename from app/models/user/status_options.rb
rename to app/models/users/status_options.rb
index e53e76c5793..eca759845fe 100644
--- a/app/models/user/status_options.rb
+++ b/app/models/users/status_options.rb
@@ -1,4 +1,4 @@
-class User
+module Users
module StatusOptions
module_function
diff --git a/app/services/authorization/user_allowed_service.rb b/app/services/authorization/user_allowed_service.rb
index 78d9f98d140..1399ccb6886 100644
--- a/app/services/authorization/user_allowed_service.rb
+++ b/app/services/authorization/user_allowed_service.rb
@@ -31,7 +31,7 @@
class Authorization::UserAllowedService
attr_accessor :user
- def initialize(user, role_cache: User::ProjectRoleCache.new(user))
+ def initialize(user, role_cache: Users::ProjectRoleCache.new(user))
self.user = user
self.project_role_cache = role_cache
end
@@ -114,7 +114,7 @@ class Authorization::UserAllowedService
end
def project_authorization_cache
- @project_authorization_cache ||= User::ProjectAuthorizationCache.new(user)
+ @project_authorization_cache ||= Users::ProjectAuthorizationCache.new(user)
end
def normalize_action(action)
diff --git a/modules/bim/app/services/bim/bcf/issues/transform_attributes_service.rb b/modules/bim/app/services/bim/bcf/issues/transform_attributes_service.rb
index 77e6fd5e8cb..701dd648c02 100644
--- a/modules/bim/app/services/bim/bcf/issues/transform_attributes_service.rb
+++ b/modules/bim/app/services/bim/bcf/issues/transform_attributes_service.rb
@@ -160,7 +160,7 @@ module Bim::Bcf
def missing_assignee(assignee_name, import_options)
if import_options[:invalid_people_action] != 'anonymize' && assignee_name
- User::InexistentUser.new
+ Users::InexistentUser.new
end
end
end
diff --git a/spec/contracts/work_packages/base_contract_spec.rb b/spec/contracts/work_packages/base_contract_spec.rb
index 27e97e50b99..62c1ff915f6 100644
--- a/spec/contracts/work_packages/base_contract_spec.rb
+++ b/spec/contracts/work_packages/base_contract_spec.rb
@@ -664,7 +664,7 @@ describe WorkPackages::BaseContract do
context 'assigned_to' do
context 'inexistent user' do
before do
- work_package.assigned_to = User::InexistentUser.new
+ work_package.assigned_to = Users::InexistentUser.new
contract.validate
end
diff --git a/spec/services/authorization/user_allowed_service_spec.rb b/spec/services/authorization/user_allowed_service_spec.rb
index c93409110c1..f9e3c97e5b8 100644
--- a/spec/services/authorization/user_allowed_service_spec.rb
+++ b/spec/services/authorization/user_allowed_service_spec.rb
@@ -167,7 +167,7 @@ describe Authorization::UserAllowedService do
before do
auth_cache = double('auth_cache')
- allow(User::ProjectAuthorizationCache)
+ allow(Users::ProjectAuthorizationCache)
.to receive(:new)
.and_return(auth_cache)