[Rt-commit] rt branch, 4.0/skip-reminders-on-ticket-clone, updated. rt-4.0.3-43-g17eacee
Jason May
jasonmay at bestpractical.com
Fri Dec 2 17:32:31 EST 2011
The branch, 4.0/skip-reminders-on-ticket-clone has been updated
via 17eaceec7fe17ea126d006d1f50b4b0447788adc (commit)
from 4d3b0f9401beb25471da7f36ac4e0d3d9ac472ee (commit)
Summary of changes:
share/html/Ticket/Create.html | 24 ++++++++++++++++--------
share/html/Ticket/ModifyLinks.html | 2 +-
t/web/ticket_links.t | 15 +++++++++++++--
3 files changed, 30 insertions(+), 11 deletions(-)
- Log -----------------------------------------------------------------
commit 17eaceec7fe17ea126d006d1f50b4b0447788adc
Author: Jason May <jasonmay at bestpractical.com>
Date: Fri Dec 2 17:24:30 2011 -0500
Preserve non-ticket links across cloning for RefersTo both ways
Using LocalBase alone didn't preserve non-ticket links. If LocalBase
wasn't defined, we should have been falling back to the URI of the link.
diff --git a/share/html/Ticket/Create.html b/share/html/Ticket/Create.html
index 919514b..b149490 100755
--- a/share/html/Ticket/Create.html
+++ b/share/html/Ticket/Create.html
@@ -299,20 +299,28 @@ if ($CloneTicket) {
my $members = $CloneTicketObj->Members;
my ( @members, @members_of, @refers, @refers_by, @depends, @depends_by );
my $refers = $CloneTicketObj->RefersTo;
+ my $get_link_value = sub {
+ my ($link, $type) = @_;
+ my $uri_method = $type . 'URI';
+ my $local_method = 'Local' . $type;
+ my $uri = $link->$uri_method;
+ return if $uri->IsLocal and
+ $uri->Object and
+ $uri->Object->isa('RT::Ticket') and
+ $uri->Object->Type eq 'reminder';
+
+ return $link->$local_method || $uri->URI;
+ };
while ( my $refer = $refers->Next ) {
- push @refers, $refer->LocalTarget;
+ my $refer_value = $get_link_value->($refer, 'Target');
+ push @refers, $refer_value if defined $refer_value;
}
$clone->{'new-RefersTo'} = join ' ', @refers;
my $refers_by = $CloneTicketObj->ReferredToBy;
while ( my $refer_by = $refers_by->Next ) {
- my $uri = $refer_by->BaseURI;
- next if $uri->IsLocal and
- $uri->Object and
- $uri->Object->isa('RT::Ticket') and
- $uri->Object->Type eq 'reminder';
-
- push @refers_by, $uri->Object->Id;
+ my $refer_by_value = $get_link_value->($refer_by, 'Base');
+ push @refers_by, $refer_by_value if defined $refer_by_value;
}
$clone->{'RefersTo-new'} = join ' ', @refers_by;
if (0) { # Temporarily disabled
diff --git a/share/html/Ticket/ModifyLinks.html b/share/html/Ticket/ModifyLinks.html
index fdb23e4..7a2db54 100755
--- a/share/html/Ticket/ModifyLinks.html
+++ b/share/html/Ticket/ModifyLinks.html
@@ -51,7 +51,7 @@
% $m->callback(CallbackName => 'BeforeActionList', Actions => \@results, ARGSRef => \%ARGS, Ticket => $Ticket);
<& /Elements/ListActions, actions => \@results &>
-<form action="ModifyLinks.html" method="post">
+<form action="ModifyLinks.html" name="ModifyLinks" method="post">
<input type="hidden" class="hidden" name="id" value="<%$Ticket->id%>" />
% $m->callback( CallbackName => 'FormStart', ARGSRef => \%ARGS );
% my (@extra);
diff --git a/t/web/ticket_links.t b/t/web/ticket_links.t
index ab0645e..8a5ec32 100644
--- a/t/web/ticket_links.t
+++ b/t/web/ticket_links.t
@@ -1,6 +1,6 @@
use strict;
use warnings;
-use RT::Test tests => 142;
+use RT::Test tests => 144;
my ( $baseurl, $m ) = RT::Test->started_ok;
ok( $m->login, "Logged in" );
@@ -120,12 +120,22 @@ for my $type ( "DependsOn", "MemberOf", "RefersTo" ) {
$m->text_contains('hello test reminder subject');
my $id = $ticket->Id;
- my $type_value = $type;
+ my $type_value = my $link_field = $type;
if ($c eq 'base') {
$type_value = "new-$type_value";
+ $link_field = "$link_field-$id";
}
else {
$type_value = "$type_value-new";
+ $link_field = "$id-$link_field";
+ }
+
+ if ($type eq 'RefersTo') {
+ $m->goto_ticket($ticket->Id);
+ $m->follow_link(id => 'page-links');
+ $m->form_name('ModifyLinks');
+ $m->field($link_field => $baseurl);
+ $m->click('SubmitTicket');
}
my $depends_on_url = sprintf(
@@ -136,6 +146,7 @@ for my $type ( "DependsOn", "MemberOf", "RefersTo" ) {
$m->form_name('TicketCreate');
$m->click_button(value => 'Create');
$m->content_lacks('hello test reminder subject');
+ $m->text_contains("(Create) $baseurl") if $type eq 'RefersTo';
}
}
}
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list