Skip to content

Commit

Permalink
Merge branch '5.0/fix-lifecycle-new-status-remove-2' into 5.0-trunk
Browse files Browse the repository at this point in the history
  • Loading branch information
sunnavy committed Jul 14, 2023
2 parents b5d56d4 + cc59e60 commit cfc3b6c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/RT/Lifecycle.pm
Original file line number Diff line number Diff line change
Expand Up @@ -994,8 +994,13 @@ 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 };
if ( $status ) {
push @warnings, $current_user->loc( "Nonexistant default [_1] status [_2] in [_3] lifecycle", $state, lc $status, $name )
unless $lifecycle->{canonical_case}{ lc $status };
}
else {
push @warnings, $current_user->loc( "Empty default [_1] status in [_2] Lifecycle", $state, $name );
}
}
for my $from ( keys %{ $lifecycle->{transitions} || {} } ) {
push @warnings, $current_user->loc( "Nonexistant status [_1] in transitions in [_2] lifecycle", lc $from, $name )
Expand Down
7 changes: 7 additions & 0 deletions share/static/js/lifecycleui-model.js
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ class LifecycleModel {
initial: [],
active: [],
inactive: [],
defaults: {},
transitions: {},
};

Expand All @@ -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;

Expand Down

0 comments on commit cfc3b6c

Please sign in to comment.