[Rt-commit] rt branch, 4.4/fix-shredder-scrip-removal, created. rt-4.4.4-47-g829ae0bf3
Blaine Motsinger
blaine at bestpractical.com
Wed Oct 23 13:54:37 EDT 2019
The branch, 4.4/fix-shredder-scrip-removal has been created
at 829ae0bf3a1111f1a98d813f6c53a0b98e3c5360 (commit)
- Log -----------------------------------------------------------------
commit 7d5502ffe1a4ee0be0d7854dbfef966c36150f36
Author: Blaine Motsinger <blaine at bestpractical.com>
Date: Fri Jun 7 17:48:41 2019 -0500
Fix removal of scrips when shredding queues
Instead of removing the scrip itself, shredder now correctly deletes
the associated ObjectScrips entry.
diff --git a/lib/RT/Queue.pm b/lib/RT/Queue.pm
index bd486ae9c..bb7feebe0 100644
--- a/lib/RT/Queue.pm
+++ b/lib/RT/Queue.pm
@@ -1122,8 +1122,8 @@ sub __DependsOn {
push( @$list, $objs );
# Scrips
- $objs = RT::Scrips->new( $self->CurrentUser );
- $objs->LimitToQueue( $self->id );
+ $objs = RT::ObjectScrips->new( $self->CurrentUser );
+ $objs->LimitToObjectId( $self->id );
push( @$list, $objs );
# Templates
commit 4370843e941d41a04124741f1be0e76d3d2bcce9
Author: Blaine Motsinger <blaine at bestpractical.com>
Date: Tue Oct 22 19:48:27 2019 -0500
Fix test to allow for remaining Scrip
diff --git a/t/shredder/02queue.t b/t/shredder/02queue.t
index 0c65c5daf..1055d20a4 100644
--- a/t/shredder/02queue.t
+++ b/t/shredder/02queue.t
@@ -22,25 +22,32 @@ diag 'simple queue' if $ENV{TEST_VERBOSE};
diag 'queue with scrip' if $ENV{TEST_VERBOSE};
{
- $test->create_savepoint('clean');
- my $queue = RT::Queue->new( RT->SystemUser );
- my ($id, $msg) = $queue->Create( Name => 'my queue' );
- ok($id, 'created queue') or diag "error: $msg";
-
my $scrip = RT::Scrip->new( RT->SystemUser );
- ($id, $msg) = $scrip->Create(
+ my ($id, $msg) = $scrip->Create(
Description => 'my scrip',
- Queue => $queue->id,
ScripCondition => 'On Create',
ScripAction => 'Open Tickets',
Template => 'Blank',
);
ok($id, 'created scrip') or diag "error: $msg";
+ # Commit 7d5502ffe makes Scrips not be deleted when a queue is shredded.
+ # we need to create the savepoint before applying the scrip so we can test
+ # to make sure it's remaining after shredding the queue.
+ $test->create_savepoint('clean');
+
+ my $queue = RT::Queue->new( RT->SystemUser );
+ ($id, $msg) = $queue->Create( Name => 'my queue' );
+ ok($id, 'created queue') or diag "error: $msg";
+
+ # apply the scrip to the queue.
+ $scrip->AddToObject( ObjectId => $queue->id );
+
my $shredder = $test->shredder_new();
$shredder->PutObjects( Objects => $queue );
$shredder->WipeoutAll;
$test->db_is_valid;
+
cmp_deeply( $test->dump_current_and_savepoint('clean'), "current DB equal to savepoint");
}
commit 829ae0bf3a1111f1a98d813f6c53a0b98e3c5360
Author: Blaine Motsinger <blaine at bestpractical.com>
Date: Wed Oct 23 12:34:33 2019 -0500
Fix removal of custom fields when shredding queues
Remove the associated ObjectCustomFields entry instead of the CF.
diff --git a/lib/RT/Queue.pm b/lib/RT/Queue.pm
index bb7feebe0..f90581932 100644
--- a/lib/RT/Queue.pm
+++ b/lib/RT/Queue.pm
@@ -1130,10 +1130,9 @@ sub __DependsOn {
$objs = $self->Templates;
push( @$list, $objs );
-# Custom Fields
- $objs = RT::CustomFields->new( $self->CurrentUser );
- $objs->SetContextObject( $self );
- $objs->LimitToQueue( $self->id );
+# Object Custom Fields
+ $objs = RT::ObjectCustomFields->new( $self->CurrentUser );
+ $objs->LimitToObjectId( $self->id );
push( @$list, $objs );
# Object Custom Roles
-----------------------------------------------------------------------
More information about the rt-commit
mailing list