Skip to content

Commit

Permalink
Revert "Remove recurring meeting feature flag"
Browse files Browse the repository at this point in the history
This reverts commit 06b7e61.
  • Loading branch information
oliverguenther committed Dec 17, 2024
1 parent bc5d508 commit 9dd7480
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 19 deletions.
3 changes: 3 additions & 0 deletions config/initializers/feature_decisions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@
description: "Allows to generate a PDF document from a work package description. " \
"See #45896 for details."

OpenProject::FeatureDecisions.add :recurring_meetings,
description: "Differentiate between one-time and recurring meetings."

# TODO: Remove once the feature flag primerized_work_package_activities is removed altogether
OpenProject::FeatureDecisions.define_singleton_method(:primerized_work_package_activities_active?) do
Rails.env.production? ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,30 @@
I18n.t(:label_meeting)
end

menu.with_item(label: I18n.t("meeting.types.structured"),
tag: :a,
href: new_dialog_meetings_path(project_id: @project&.id, type: :structured),
content_arguments: { data: { controller: "async-dialog" }}
) do |item|
item.with_description.with_content(t("meeting.types.structured_text"))
end
if OpenProject::FeatureDecisions.recurring_meetings_active?
menu.with_item(label: I18n.t("meeting.types.one_time"),
tag: :a,
href: new_dialog_meetings_path(project_id: @project&.id, type: :structured),
content_arguments: { data: { controller: "async-dialog" }}
) do |item|
item.with_description.with_content(t("meeting.types.structured_text"))
end

menu.with_item(label: I18n.t("meeting.types.recurring"),
tag: :a,
href: new_dialog_meetings_path(project_id: @project&.id, type: :recurring),
content_arguments: { data: { controller: "async-dialog" }}
) do |item|
item.with_description.with_content(t("meeting.types.recurring_text"))
menu.with_item(label: I18n.t("meeting.types.recurring"),
tag: :a,
href: new_dialog_meetings_path(project_id: @project&.id, type: :recurring),
content_arguments: { data: { controller: "async-dialog" }}
) do |item|
item.with_description.with_content(t("meeting.types.recurring_text"))
end
else
menu.with_item(label: I18n.t("meeting.types.structured"),
tag: :a,
href: new_dialog_meetings_path(project_id: @project&.id, type: :structured),
content_arguments: { data: { controller: "async-dialog" }}
) do |item|
item.with_description.with_content(t("meeting.types.structured_text"))
end
end

menu.with_item(label: I18n.t("meeting.types.classic"),
Expand Down
14 changes: 11 additions & 3 deletions modules/meeting/app/menus/meetings/menu.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ def initialize(params:, project: nil)
def menu_items
[
OpenProject::Menu::MenuGroup.new(header: nil, children: top_level_menu_items),
OpenProject::Menu::MenuGroup.new(header: I18n.t(:label_meeting_series), children: meeting_series_menu_items),
meeting_series_menu_group,
OpenProject::Menu::MenuGroup.new(header: I18n.t(:label_involvement), children: involvement_sidebar_menu_items)
]
].compact
end

def top_level_menu_items
Expand All @@ -49,7 +49,13 @@ def top_level_menu_items
recurring_menu_item,
menu_item(title: I18n.t(:label_all_meetings),
query_params: { filters: all_filter })
]
].compact
end

def meeting_series_menu_group
return unless OpenProject::FeatureDecisions.recurring_meetings_active?

OpenProject::Menu::MenuGroup.new(header: I18n.t(:label_meeting_series), children: meeting_series_menu_items)
end

def meeting_series_menu_items
Expand All @@ -71,6 +77,8 @@ def meeting_series_menu_items
end

def recurring_menu_item
return unless OpenProject::FeatureDecisions.recurring_meetings_active?

recurring_filter = [{ type: { operator: "=", values: ["t"] } }].to_json

menu_item(title: I18n.t("label_recurring_meeting_plural"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ def human_name
I18n.t("label_recurring_meeting_part_of")
end

def available?
OpenProject::FeatureDecisions.recurring_meetings_active?
end

def apply_to(query_scope)
if allowed_values.first.intersect?(values)
query_scope.recurring
Expand Down
3 changes: 2 additions & 1 deletion modules/meeting/config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@ en:
types:
classic: "Classic"
classic_text: "Organize your meeting as a single formattable text agenda and protocol."
structured: "One-time"
structured: "Structured"
one_time: "One-time"
recurring: "Recurring"
recurring_text: "Create meeting series with dynamic template for each occurrence."
structured_text: "Organize your meeting as a dynamic list of agenda items, optionally linking them to a work package."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@

RSpec.describe "Recurring meetings creation",
:js,
:with_cuprite do
:with_cuprite,
with_flag: { recurring_meetings: true } do
include Components::Autocompleter::NgSelectAutocompleteHelpers

shared_let(:project) { create(:project, enabled_module_names: %w[meetings]) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@

RSpec.describe "Recurring meetings CRUD",
:js,
:with_cuprite do
:with_cuprite,
with_flag: { recurring_meetings: true } do
include Components::Autocompleter::NgSelectAutocompleteHelpers

shared_let(:project) { create(:project, enabled_module_names: %w[meetings]) }
Expand Down

0 comments on commit 9dd7480

Please sign in to comment.