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

fix: move status discovery into a class method of Meeting::Statuses

as-op862dc573b620
diff --git a/modules/meeting/app/constants/meetings/statuses.rb b/modules/meeting/app/constants/meetings/statuses.rb
index 4391489a8c0..57c587f0567 100644
--- a/modules/meeting/app/constants/meetings/statuses.rb
+++ b/modules/meeting/app/constants/meetings/statuses.rb
@@ -41,5 +41,9 @@ module Meetings
IN_PROGRESS,
CLOSED
].freeze
+
+ def self.find_by_id(id)
+ AVAILABLE.find { |status| status.id == id }
+ end
end
end
diff --git a/modules/meeting/app/workers/meetings/pdf/page_head.rb b/modules/meeting/app/workers/meetings/pdf/page_head.rb
index 3d771725c26..b61c84de16e 100644
--- a/modules/meeting/app/workers/meetings/pdf/page_head.rb
+++ b/modules/meeting/app/workers/meetings/pdf/page_head.rb
@@ -79,11 +79,8 @@ module Meetings::PDF
end
def meetings_state_color
- state_color = Meetings::Statuses::AVAILABLE.find { |it| it.id == meeting.state }
- return state_color.color if state_color
-
- # Fallback to the default color if the state is not found
- Meetings::Statuses::OPEN.color
+ status = Meetings::Statuses.find_by_id(meeting.state)
+ (status || Meetings::Statuses::OPEN).color
end
def meeting_title