[Rt-commit] rt branch 5.0/fix-lifecycle-new-status-remove-2 created. rt-5.0.4-57-gd492bdd4ef

BPS Git Server git at git.bestpractical.com
Wed Jul 12 17:20:21 UTC 2023


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rt".

The branch, 5.0/fix-lifecycle-new-status-remove-2 has been created
        at  d492bdd4efa04f7b4fd59d4c574e682457670003 (commit)

- Log -----------------------------------------------------------------
commit d492bdd4efa04f7b4fd59d4c574e682457670003
Author: Ronaldo Richieri <ronaldo at bestpractical.com>
Date:   Wed Jul 12 12:43:45 2023 -0300

    Improve Lifecycle validation messages
    
    Users were getting non clear message when trying to update Lifecycles
    without required default configuration.

diff --git a/lib/RT/Lifecycle.pm b/lib/RT/Lifecycle.pm
index 9f8701438e..5949843f68 100644
--- a/lib/RT/Lifecycle.pm
+++ b/lib/RT/Lifecycle.pm
@@ -994,8 +994,10 @@ sub ValidateLifecycle {
     # ->{actions} are handled below
     for my $state ( keys %{ $lifecycle->{defaults} || {} } ) {
         my $status = $lifecycle->{defaults}{$state};
-        push @warnings, $current_user->loc( "Nonexistant status [_1] in default states in [_2] lifecycle", lc $status, $name )
-            unless $lifecycle->{canonical_case}{ lc $status };
+        push @warnings, $current_user->loc( "[_1] Lifecycle has no default [_2] config", $name, $state )
+            unless $status;
+        push @warnings, $current_user->loc( "Nonexistant status [_1] in default [_2] in [_3] lifecycle", lc $status, $state, $name )
+            if $status && !$lifecycle->{canonical_case}{ lc $status };
     }
     for my $from ( keys %{ $lifecycle->{transitions} || {} } ) {
         push @warnings, $current_user->loc( "Nonexistant status [_1] in transitions in [_2] lifecycle", lc $from, $name )

commit 64666b75e047a2b917d7640607e6e9c7ba2d272f
Author: Ronaldo Richieri <ronaldo at bestpractical.com>
Date:   Wed Jul 12 12:29:55 2023 -0300

    Fix lifecycle new status removal
    
    on_create default config was not being replaced correctly with a new
    status, which caused an error when saving the lifecycle.
    We are now falling back to the next available state on config.initial
    and to config.active after that.

diff --git a/share/static/js/lifecycleui-model.js b/share/static/js/lifecycleui-model.js
index 2a1dae32cf..63862bf389 100644
--- a/share/static/js/lifecycleui-model.js
+++ b/share/static/js/lifecycleui-model.js
@@ -298,6 +298,7 @@ class LifecycleModel {
             initial:  [],
             active:   [],
             inactive: [],
+            defaults: {},
             transitions: {},
         };
 
@@ -306,6 +307,12 @@ class LifecycleModel {
             config[type] = self.nodes.filter(function(n) { return n.type == type }).map(function(n) { return n.name });
         });
 
+        // Set defaults on_create
+        config.defaults.on_create = config.initial[0] || config.active[0] || null;
+
+        // Clean removed states from create_nodes
+        self.create_nodes = self.create_nodes.filter(target => self.nodes.find(n => n.name == target));
+
         // Grab our links
         config.transitions[""] = self.create_nodes;
 

-----------------------------------------------------------------------


hooks/post-receive
-- 
rt


More information about the rt-commit mailing list