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 `allowed_to` scope in `visible` scope

Klaus Zanders02ed257b4cc2
diff --git a/app/models/work_package.rb b/app/models/work_package.rb
index c8dfd94a88b..48b11741123 100644
--- a/app/models/work_package.rb
+++ b/app/models/work_package.rb
@@ -80,7 +80,8 @@ class WorkPackage < ApplicationRecord
}
scope :visible, ->(*args) {
- where(project_id: Project.allowed_to(args.first || User.current, :view_work_packages))
+ where(id: allowed_to(args.first || User.current, :view_work_packages))
+ # where(project_id: Project.allowed_to(args.first || User.current, :view_work_packages))
}
scope :in_status, ->(*args) do