@@ -54,18 +54,10 @@ def edit
5454 end
5555
5656 def update # rubocop:disable Metrics/AbcSize
57- success = false
58- Workflow . transaction do
59- success = true
60- base_params = permitted_status_params
61- indeterminate = permitted_indeterminate_params
62- @roles . each do |role |
63- role_params = indeterminate . empty? ? base_params : role_specific_params ( base_params , indeterminate , role )
64- result = Workflows ::BulkUpdateService . new ( role :, type : @type , tab : @tab )
65- . call ( role_params )
66- success = false unless result . success?
67- end
68- raise ActiveRecord ::Rollback unless success
57+ success = persist_matrix
58+
59+ if success && params [ :advance_to_step ] . present?
60+ return redirect_to type_creation_wizard_path ( @type , step : params [ :advance_to_step ] ) , status : :see_other
6961 end
7062
7163 if success
@@ -199,6 +191,27 @@ def workflows_for_form
199191 @workflows [ "assignee" ] = workflows . select ( &:assignee )
200192 end
201193
194+ # A linked type reuses its source's transitions and must never have its own
195+ # rewritten, so it persists nothing and simply reports success.
196+ def persist_matrix
197+ return true if @type . linked? ( Type ::ConfigurationLink ::WORKFLOWS )
198+
199+ success = false
200+ Workflow . transaction do
201+ success = true
202+ base_params = permitted_status_params
203+ indeterminate = permitted_indeterminate_params
204+ @roles . each do |role |
205+ role_params = indeterminate . empty? ? base_params : role_specific_params ( base_params , indeterminate , role )
206+ result = Workflows ::BulkUpdateService . new ( role :, type : @type , tab : @tab )
207+ . call ( role_params )
208+ success = false unless result . success?
209+ end
210+ raise ActiveRecord ::Rollback unless success
211+ end
212+ success
213+ end
214+
202215 def permitted_status_params
203216 status_params ( "status" )
204217 end
0 commit comments