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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Define outcome behaviour for backlogs
Mir Bhatia4ad120236e6f
diff --git a/modules/meeting/app/components/meeting_agenda_items/item_component/show_component.rb b/modules/meeting/app/components/meeting_agenda_items/item_component/show_component.rbindex b974a8b89ad..73e70db2555 100644--- a/modules/meeting/app/components/meeting_agenda_items/item_component/show_component.rb+++ b/modules/meeting/app/components/meeting_agenda_items/item_component/show_component.rb@@ -60,7 +60,10 @@ module MeetingAgendaItemsenddef add_outcome_action?- @meeting_agenda_item.editable? && @meeting.in_progress? && !@meeting_agenda_item.outcomes.exists?+ @meeting_agenda_item.editable? &&+ @meeting.in_progress? &&+ !@meeting_agenda_item.outcomes.exists? &&+ @meeting_agenda_item.in_backlog?enddef first?diff --git a/modules/meeting/app/components/meeting_agenda_items/outcomes/new_button_component.rb b/modules/meeting/app/components/meeting_agenda_items/outcomes/new_button_component.rbindex 0135675733f..0d04b7e04a3 100644--- a/modules/meeting/app/components/meeting_agenda_items/outcomes/new_button_component.rb+++ b/modules/meeting/app/components/meeting_agenda_items/outcomes/new_button_component.rb@@ -46,7 +46,9 @@ module MeetingAgendaItems::Outcomesenddef render?- @meeting.in_progress? && User.current.allowed_in_project?(:create_meeting_minutes, @meeting.project)+ @meeting.in_progress? &&+ User.current.allowed_in_project?(:create_meeting_minutes, @meeting.project) &&+ @meeting_agenda_item.in_backlog?endendenddiff --git a/modules/meeting/app/components/meeting_agenda_items/outcomes/show_notes_component.rb b/modules/meeting/app/components/meeting_agenda_items/outcomes/show_notes_component.rbindex bfa9bd7ad3c..1ad96b5c277 100644--- a/modules/meeting/app/components/meeting_agenda_items/outcomes/show_notes_component.rb+++ b/modules/meeting/app/components/meeting_agenda_items/outcomes/show_notes_component.rb@@ -38,13 +38,16 @@ module MeetingAgendaItemssuper@meeting_outcome = meeting_outcome- @meeting = @meeting_outcome.meeting_agenda_item.meeting+ @agenda_item = meeting_outcome.meeting_agenda_item+ @meeting = @agenda_item.meetingendprivatedef edit_enabled?- @meeting.in_progress? && User.current.allowed_in_project?(:create_meeting_minutes, @meeting.project)+ @meeting.in_progress? &&+ User.current.allowed_in_project?(:create_meeting_minutes, @meeting.project) &&+ @agenda_item.in_backlog?enddef edit_action_item(menu)diff --git a/modules/meeting/app/contracts/meeting_outcomes/editable_item.rb b/modules/meeting/app/contracts/meeting_outcomes/editable_item.rbindex c41c0c390ef..85f3bc3cbdd 100644--- a/modules/meeting/app/contracts/meeting_outcomes/editable_item.rb+++ b/modules/meeting/app/contracts/meeting_outcomes/editable_item.rb@@ -33,7 +33,7 @@ module MeetingOutcomesextend ActiveSupport::Concernincluded do- validate :validate_editable, :validate_meeting_existence, :user_allowed_to_add+ validate :validate_editable, :validate_meeting_existence, :user_allowed_to_add, :validate_not_in_backlogendprotected@@ -62,6 +62,12 @@ module MeetingOutcomesendend+ def validate_not_in_backlog+ unless model.meeting_agenda_item.in_backlog?+ errors.add :base, I18n.t(:text_outcome_not_editable_anymore)+ end+ end+privatedef visible?diff --git a/modules/meeting/app/controllers/meeting_outcomes_controller.rb b/modules/meeting/app/controllers/meeting_outcomes_controller.rbindex 2e7e5245349..c0648bf14ba 100644--- a/modules/meeting/app/controllers/meeting_outcomes_controller.rb+++ b/modules/meeting/app/controllers/meeting_outcomes_controller.rb@@ -41,11 +41,11 @@ class MeetingOutcomesController < ApplicationControllerdef newupdate_all_via_turbo_stream- if @meeting.in_progress?+ if @meeting.in_progress? && @meeting_agenda_item.in_backlog?render_base_outcome_component_via_turbo_stream(meeting: @meeting, meeting_agenda_item: @meeting_agenda_item,meeting_outcome: nil, edit: true)else- render_error_flash_message_via_turbo_stream(message: t("text_meeting_not_editable_anymore"))+ render_error_flash_message_via_turbo_stream(message: t("text_outcome_cannot_be_added"))endrespond_with_turbo_streamsdiff --git a/modules/meeting/app/models/meeting_agenda_item.rb b/modules/meeting/app/models/meeting_agenda_item.rbindex 8b525f100e3..6eb999f08e8 100644--- a/modules/meeting/app/models/meeting_agenda_item.rb+++ b/modules/meeting/app/models/meeting_agenda_item.rb@@ -124,4 +124,8 @@ class MeetingAgendaItem < ApplicationRecorddef copy_attributesattributes.except("id", "meeting_id")end++ def in_backlog?+ !meeting_section.backlog?+ endenddiff --git a/modules/meeting/config/locales/en.yml b/modules/meeting/config/locales/en.ymlindex d2fef072055..fc12601cfbc 100644--- a/modules/meeting/config/locales/en.yml+++ b/modules/meeting/config/locales/en.yml@@ -435,9 +435,6 @@ en:label_backlog_clear_button: "Clear all"text_backlog_clear_error: "One or more errors occurred while trying to clear the backlog."- label_backlog_clear: "Clear backlog"- label_backlog_clear_button: "Clear all"-label_agenda_backlog: "Agenda backlog"text_agenda_backlog: "This backlog is unique to this one-time meeting. You can drag items in and out to add or remove them from the meeting agenda."label_agenda_backlog_clear_title: "Clear agenda backlog?"diff --git a/modules/meeting/spec/contracts/meeting_outcomes/create_contract_spec.rb b/modules/meeting/spec/contracts/meeting_outcomes/create_contract_spec.rbindex e07e30c5243..e97fa8549a1 100644--- a/modules/meeting/spec/contracts/meeting_outcomes/create_contract_spec.rb+++ b/modules/meeting/spec/contracts/meeting_outcomes/create_contract_spec.rb@@ -76,6 +76,15 @@ RSpec.describe MeetingOutcomes::CreateContract doit_behaves_like "contract is invalid", base: I18n.t(:text_outcome_not_editable_anymore)end++ context "when :meeting_agenda_item is in a backlog" do+ before do+ meeting.update_column(:state, :in_progress)+ meeting_agenda_item.meeting_section.update_column(:backlog, true)+ end++ it_behaves_like "contract is invalid", base: I18n.t(:text_outcome_not_editable_anymore)+ endendcontext "without permission" do