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

Update meeting instance variable to the one from the service

Oliver Güntherb1a4a410f7d6
diff --git a/modules/meeting/app/controllers/meeting_agenda_items_controller.rb b/modules/meeting/app/controllers/meeting_agenda_items_controller.rb
index 2a4c5859ae4..757e9d741ff 100644
--- a/modules/meeting/app/controllers/meeting_agenda_items_controller.rb
+++ b/modules/meeting/app/controllers/meeting_agenda_items_controller.rb
@@ -69,8 +69,6 @@ class MeetingAgendaItemsController < ApplicationController
end
def create
- # clear_slate = @meeting.agenda_items.empty?
-
call = ::MeetingAgendaItems::CreateService
.new(user: current_user)
.call(
@@ -83,6 +81,7 @@ class MeetingAgendaItemsController < ApplicationController
@meeting_agenda_item = call.result
if call.success?
+ set_meeting_from_agenda_item
# enable continue editing
add_item_via_turbo_stream(clear_slate: false)
update_header_component_via_turbo_stream
@@ -121,6 +120,7 @@ class MeetingAgendaItemsController < ApplicationController
.call(meeting_agenda_item_params)
if call.success?
+ set_meeting_from_agenda_item
update_item_via_turbo_stream
update_section_header_via_turbo_stream(meeting_section: @meeting_agenda_item.meeting_section)
update_header_component_via_turbo_stream
@@ -142,6 +142,7 @@ class MeetingAgendaItemsController < ApplicationController
.call
if call.success?
+ set_meeting_from_agenda_item
remove_item_via_turbo_stream(clear_slate: @meeting.agenda_items.empty?)
update_header_component_via_turbo_stream
update_section_header_via_turbo_stream(meeting_section: section) if section&.reload.present?
@@ -199,6 +200,12 @@ class MeetingAgendaItemsController < ApplicationController
@project = @meeting.project # required for authorization via before_action
end
+ # In case we updated the meeting as part of the service flow
+ # it needs to be reassigned for the controller in order to get correct timestamps
+ def set_meeting_from_agenda_item
+ @meeting = @meeting_agenda_item.meeting
+ end
+
def set_agenda_item_type
@agenda_item_type = params[:type]&.to_sym
end