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

refactor: simplify logic

Christophe Bliardc10d44695843
diff --git a/app/models/activities/fetcher.rb b/app/models/activities/fetcher.rb
index 0fe564a3b9c..bb44e556a40 100644
--- a/app/models/activities/fetcher.rb
+++ b/app/models/activities/fetcher.rb
@@ -49,13 +49,10 @@ module Activities
@event_types ||=
if @project
OpenProject::Activity.available_event_types.select do |o|
- @project.self_and_descendants.detect do |_p|
- permissions = constantized_providers(o).map do |p|
- p.activity_provider_options[:permission]
- end.compact
-
- permissions.all? { |p| @user.allowed_to?(p, @project) }
- end
+ permissions = constantized_providers(o).map do |activity_provider|
+ activity_provider.activity_provider_options[:permission]
+ end.compact
+ permissions.all? { |p| @user.allowed_to?(p, @project) }
end
else
OpenProject::Activity.available_event_types.to_a