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

Override type condition set by rails when scoping User

Christophe Bliardc64444dea724
diff --git a/app/models/principals/scopes/user.rb b/app/models/principals/scopes/user.rb
index 0009e22dce6..abf2ac99a96 100644
--- a/app/models/principals/scopes/user.rb
+++ b/app/models/principals/scopes/user.rb
@@ -37,7 +37,7 @@ module Principals::Scopes
def user
# Have to use the User model here so that the scopes defined on User
# are also available after the scope is used.
- where(type: [::User.name])
+ rewhere(type: [::User.name])
end
end
end
diff --git a/spec/models/queries/users/user_query_spec.rb b/spec/models/queries/users/user_query_spec.rb
index 627f89d0815..a5dfeab9c20 100644
--- a/spec/models/queries/users/user_query_spec.rb
+++ b/spec/models/queries/users/user_query_spec.rb
@@ -27,9 +27,6 @@
#++
require 'spec_helper'
-# prevents test failures where the system user
-# is mentioned in the User.user scope
-require 'system_user'
describe Queries::Users::UserQuery, type: :model do
let(:instance) { described_class.new }