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

[#62979] slight follow up refactoring

Tobias Dillmann997483012589
diff --git a/lib/api/v3/project_phases/project_phase_representer.rb b/lib/api/v3/project_phases/project_phase_representer.rb
index b4093fe5aba..71b4f5756b4 100644
--- a/lib/api/v3/project_phases/project_phase_representer.rb
+++ b/lib/api/v3/project_phases/project_phase_representer.rb
@@ -62,6 +62,8 @@ module API
end
end
+ # FIXME: This name is automatically generated by the ParamsToQueryService - this alias here is just a quick way
+ # to make this class discoverable. Consider fixing the ParamsToQueryService to use the correct name instead.
class ProjectPhasesRepresenter < ProjectPhaseRepresenter
end
end
diff --git a/lib/api/v3/project_phases/project_phases_api.rb b/lib/api/v3/project_phases/project_phases_api.rb
index 19de601c232..4edfab98f52 100644
--- a/lib/api/v3/project_phases/project_phases_api.rb
+++ b/lib/api/v3/project_phases/project_phases_api.rb
@@ -35,8 +35,7 @@ module API
resources :project_phases do
get &::API::V3::Utilities::Endpoints::Index
.new(model: Project::Phase,
- # TODO: add visible-scope here:
- scope: -> { Project::Phase.where(active: true) },
+ scope: -> { Project::Phase.visible(current_user).where(active: true) },
api_name: "ProjectPhases")
.mount
diff --git a/lib/api/v3/queries/schemas/project_phase_filter_dependency_representer.rb b/lib/api/v3/queries/schemas/project_phase_filter_dependency_representer.rb
index 7f249b8b864..f5a7123e866 100644
--- a/lib/api/v3/queries/schemas/project_phase_filter_dependency_representer.rb
+++ b/lib/api/v3/queries/schemas/project_phase_filter_dependency_representer.rb
@@ -42,20 +42,7 @@ module API
end
def href_callback
- params = CGI.escape(::JSON.dump(filter_query))
-
- # if filter.project.present?
- # "#{api_v3_paths.project_phases_by_project(filter.project.identifier)}?filters=#{params}"
- # else
- "#{api_v3_paths.project_phase_definitions}?filters=#{params}"
- # end
- end
-
- # FIXME only request the project phases that are actually used in the query!
- # alternatively, fix the API query to return only active and visible project phase definitions
- def filter_query
- # [{ project_phase: { operator: "*", values: [] } }]
- []
+ api_v3_paths.project_phase_definitions
end
def type