[Rt-commit] rt branch, 4.2/pseudo-from-ticket-creation, created. rt-4.2.9-77-ga956efd
Wallace Reis
wreis at bestpractical.com
Wed Feb 4 09:00:25 EST 2015
The branch, 4.2/pseudo-from-ticket-creation has been created
at a956efd672154dca8a7c0696b52c2ac88751c4da (commit)
- Log -----------------------------------------------------------------
commit e82b9c0fc1ef8b6c9003076e51b386b231c82b88
Author: Wallace Reis <wreis at bestpractical.com>
Date: Mon Jan 26 20:56:19 2015 -0200
Lexically cache current user in ticket creation
diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index efdd301..0603138 100644
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -2066,9 +2066,10 @@ sub CreateTicket {
my (@Actions);
- my $Ticket = RT::Ticket->new( $session{'CurrentUser'} );
+ my $current_user = $session{'CurrentUser'};
+ my $Ticket = RT::Ticket->new( $current_user );
- my $Queue = RT::Queue->new( $session{'CurrentUser'} );
+ my $Queue = RT::Queue->new( $current_user );
unless ( $Queue->Load( $ARGS{'Queue'} ) ) {
Abort('Queue not found');
}
@@ -2079,12 +2080,12 @@ sub CreateTicket {
my $due;
if ( defined $ARGS{'Due'} and $ARGS{'Due'} =~ /\S/ ) {
- $due = RT::Date->new( $session{'CurrentUser'} );
+ $due = RT::Date->new( $current_user );
$due->Set( Format => 'unknown', Value => $ARGS{'Due'} );
}
my $starts;
if ( defined $ARGS{'Starts'} and $ARGS{'Starts'} =~ /\S/ ) {
- $starts = RT::Date->new( $session{'CurrentUser'} );
+ $starts = RT::Date->new( $current_user );
$starts->Set( Format => 'unknown', Value => $ARGS{'Starts'} );
}
@@ -2092,7 +2093,7 @@ sub CreateTicket {
Content => $ARGS{Content},
ContentType => $ARGS{ContentType},
StripSignature => 1,
- CurrentUser => $session{'CurrentUser'},
+ CurrentUser => $current_user,
);
my $MIMEObj = MakeMIMEEntity(
diff --git a/share/html/Ticket/Create.html b/share/html/Ticket/Create.html
index 4639c1d..dcbc0fb 100644
--- a/share/html/Ticket/Create.html
+++ b/share/html/Ticket/Create.html
@@ -299,6 +299,8 @@ $m->callback( CallbackName => "Init", ARGSRef => \%ARGS );
my $Queue = $ARGS{Queue};
$session{DefaultQueue} = $Queue;
+my $current_user = $session{'CurrentUser'};
+
if ($CloneTicket) {
my $CloneTicketObj = RT::Ticket->new( $session{CurrentUser} );
$CloneTicketObj->Load($CloneTicket)
@@ -374,7 +376,7 @@ my @results;
my $title = loc("Create a new ticket");
-my $QueueObj = RT::Queue->new($session{'CurrentUser'});
+my $QueueObj = RT::Queue->new($current_user);
$QueueObj->Load($Queue) || Abort(loc("Queue [_1] could not be loaded.", $Queue||''));
$m->callback( QueueObj => $QueueObj, title => \$title, results => \@results, ARGSRef => \%ARGS );
@@ -383,7 +385,7 @@ $m->scomp( '/Articles/Elements/SubjectOverride', ARGSRef => \%ARGS, QueueObj =>
$QueueObj->Disabled && Abort(loc("Cannot create tickets in a disabled queue."));
-my $ticket = RT::Ticket->new($session{'CurrentUser'}); # empty ticket object
+my $ticket = RT::Ticket->new($current_user); # empty ticket object
ProcessAttachments(ARGSRef => \%ARGS);
commit a956efd672154dca8a7c0696b52c2ac88751c4da
Author: Wallace Reis <wreis at bestpractical.com>
Date: Mon Jan 26 20:56:33 2015 -0200
Consistency on ticket creation
RT mocks a MIME object using ticket metadata during creation through web
UI which doesn't bother to include the basic email headers -- except for
quick ticket creation form. Hence set it at the full create page for
consistency's sakes.
Fixes: I#30602
diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index 0603138..fdef196 100644
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -2096,10 +2096,15 @@ sub CreateTicket {
CurrentUser => $current_user,
);
+ my $date_now = RT::Date->new( $current_user );
+ $date_now->SetToNow;
my $MIMEObj = MakeMIMEEntity(
Subject => $ARGS{'Subject'},
- From => $ARGS{'From'},
+ From => $ARGS{'From'} || $current_user->EmailAddress,
+ To => $ARGS{'To'} || $Queue->CorrespondAddress
+ || RT->Config->Get('CorrespondAddress'),
Cc => $ARGS{'Cc'},
+ Date => $date_now->RFC2822(Timezone => 'user'),
Body => $sigless,
Type => $ARGS{'ContentType'},
Interface => RT::Interface::Web::MobileClient() ? 'Mobile' : 'Web',
diff --git a/share/html/index.html b/share/html/index.html
index a307814..8f89afb 100644
--- a/share/html/index.html
+++ b/share/html/index.html
@@ -110,7 +110,6 @@ if ( $ARGS{'QuickCreate'} ) {
Status => $ARGS{'Status'},
# yes! it's Requestors, not Requestor
Requestors => $ARGS{'Requestors'},
- From => $session{'CurrentUser'}->EmailAddress,
Content => $ARGS{'Content'},
Subject => $ARGS{'Subject'});
push @results, $msg;
-----------------------------------------------------------------------
More information about the rt-commit
mailing list