[Rt-commit] rt branch, 4.0/forbid-linking-deleted-tickets, created. rt-4.0.0-188-gabbdf26
? sunnavy
sunnavy at bestpractical.com
Mon May 9 03:05:42 EDT 2011
The branch, 4.0/forbid-linking-deleted-tickets has been created
at abbdf26605d5c6277145ca0fa09a9aee755edede (commit)
- Log -----------------------------------------------------------------
commit d41cdb7e5265cc1132a6caca7a39b29c1c95b8f9
Author: sunnavy <sunnavy at bestpractical.com>
Date: Mon May 9 14:07:11 2011 +0800
we skip deleted tickets elsewhere
diff --git a/share/html/Elements/ShowLinks b/share/html/Elements/ShowLinks
index c35cabc..6f330d3 100755
--- a/share/html/Elements/ShowLinks
+++ b/share/html/Elements/ShowLinks
@@ -58,6 +58,7 @@ my ( @active, @inactive, @not_tickets );
for my $link ( @{ $Ticket->DependsOn->ItemsArrayRef } ) {
my $target = $link->TargetObj;
if ( $target && $target->isa('RT::Ticket') ) {
+ next if $target->Status eq 'deleted';
if ( $target->QueueObj->IsInactiveStatus( $target->Status ) ) {
push( @inactive, $link->TargetURI );
}
commit abbdf26605d5c6277145ca0fa09a9aee755edede
Author: sunnavy <sunnavy at bestpractical.com>
Date: Mon May 9 14:08:01 2011 +0800
ticket links test
diff --git a/t/web/ticket_links.t b/t/web/ticket_links.t
new file mode 100644
index 0000000..4071dde
--- /dev/null
+++ b/t/web/ticket_links.t
@@ -0,0 +1,85 @@
+use strict;
+use warnings;
+use RT::Test tests => 73;
+
+my ( $baseurl, $m ) = RT::Test->started_ok;
+ok( $m->login, "Logged in" );
+
+my $queue = RT::Test->load_or_create_queue( Name => 'General' );
+ok( $queue->Id, "loaded the General queue" );
+
+my ( $deleted, $active, $inactive ) = RT::Test->create_tickets(
+ { Queue => 'General' },
+ { Subject => 'deleted ticket', },
+ { Subject => 'active ticket', },
+ { Subject => 'inactive ticket', }
+);
+
+my ( $deleted_id, $active_id, $inactive_id ) =
+ ( $deleted->id, $active->id, $inactive->id );
+
+$deleted->SetStatus('deleted');
+is( $deleted->Status, 'deleted', "deleted $deleted_id" );
+
+$inactive->SetStatus('resolved');
+is( $inactive->Status, 'resolved', 'resolved $inactive_id' );
+
+for my $type ( "DependsOn", "MemberOf", "RefersTo" ) {
+ for my $c (qw/base target/) {
+ my $ticket = RT::Test->create_ticket(
+ Queue => 'General',
+ Subject => "test $type $c",
+ );
+ my $id = $ticket->id;
+
+ $m->goto_ticket($id);
+ $m->follow_link_ok( { text => 'Links' }, "Followed link to Links" );
+
+ ok( $m->form_with_fields("$id-DependsOn"), "found the form" );
+ if ( $c eq 'base' ) {
+ $m->field( "$id-$type", "$deleted_id $active_id $inactive_id" );
+ }
+ else {
+ $m->field( "$type-$id", "$deleted_id $active_id $inactive_id" );
+ }
+ $m->submit;
+
+ if ( $c eq 'base' ) {
+ $m->content_like(
+ qr{"DeleteLink--$type-.*?ticket/$active_id"},
+ "$c for $type: has active ticket",
+ );
+ $m->content_like(
+ qr{"DeleteLink--$type-.*?ticket/$inactive_id"},
+ "base for $type: has inactive ticket",
+ );
+ $m->content_unlike(
+ qr{"DeleteLink--$type-.*?ticket/$deleted_id"},
+ "base for $type: no deleted ticket",
+ );
+ }
+ else {
+ $m->content_like(
+ qr{"DeleteLink-.*?ticket/$active_id-$type-"},
+ "$c for $type: has active ticket",
+ );
+ $m->content_like(
+ qr{"DeleteLink-.*?ticket/$inactive_id-$type-"},
+ "base for $type: has inactive ticket",
+ );
+ $m->content_unlike(
+ qr{"DeleteLink-.*?ticket/$deleted_id-$type-"},
+ "base for $type: no deleted ticket",
+ );
+ }
+
+ $m->goto_ticket($id);
+ $m->content_like( qr{$active_id:.*?\[new\]}, "has active ticket", );
+ $m->content_like(
+ qr{$inactive_id:.*?\[resolved\]},
+ "has inactive ticket",
+ );
+ $m->content_unlike( qr{$deleted_id.*?\[deleted\]}, "no deleted ticket", );
+ }
+}
+
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list