[Rt-commit] rt branch, 4.4/attach-from-ticket, created. rt-4.2.11-212-g24b80c2

? sunnavy sunnavy at bestpractical.com
Fri Oct 2 14:05:14 EDT 2015


The branch, 4.4/attach-from-ticket has been created
        at  24b80c26bbdfd6aefdf04e5d10a45e59cc13ca3f (commit)

- Log -----------------------------------------------------------------
commit 5ff6cf530d7670d0e9c129ea11b3c161de666a91
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Sat Oct 3 01:27:22 2015 +0800

    allow to attach existing attachments from the whole ticket

diff --git a/share/html/Ticket/Elements/AddAttachments b/share/html/Ticket/Elements/AddAttachments
index 74a4faf..c3dced5 100644
--- a/share/html/Ticket/Elements/AddAttachments
+++ b/share/html/Ticket/Elements/AddAttachments
@@ -189,13 +189,9 @@ if ( exists $session{'Attachments'}{ $Token } && keys %{ $session{'Attachments'}
 }
 
 my @quoted_attachments;
-if ($QuoteTransaction and $TicketObj and $TicketObj->id) {
-    my $txn = RT::Transaction->new( $session{'CurrentUser'} );
-    $txn->Load($QuoteTransaction);
-    if ($txn->Id and $txn->CurrentUserCanSee) {
-        @quoted_attachments = sort { lc($a->Filename) cmp lc($b->Filename) }
-                              grep { defined $_->Filename and length $_->Filename }
-                                  @{$txn->Attachments->ItemsArrayRef};
-    }
+if ($TicketObj and $TicketObj->id) {
+    @quoted_attachments = sort { lc($a->Filename) cmp lc($b->Filename) }
+                          grep { defined $_->Filename and length $_->Filename }
+                            @{$TicketObj->Attachments->ItemsArrayRef};
 }
 </%INIT>

commit ef197b4b0a5446d17bc04c1b19105d111f381200
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Sat Oct 3 01:35:01 2015 +0800

    show more info about attachments in case there are duplicated names
    
    it's common to have multiple attachments that share the same name in a ticket.
    the info uses exactly the same format as in /Ticket/Elements/ShowAttachments

diff --git a/share/html/Ticket/Elements/AddAttachments b/share/html/Ticket/Elements/AddAttachments
index c3dced5..27e0eec 100644
--- a/share/html/Ticket/Elements/AddAttachments
+++ b/share/html/Ticket/Elements/AddAttachments
@@ -163,6 +163,7 @@ jQuery( function() {
       <input type="checkbox" class="checkbox" name="AttachExisting" value="<% $attach->Id %>" \
              <% (grep { $attach->Id == $_ } @AttachExisting) ? 'checked' : '' %> />
       <% $attach->Filename %>
+      <% loc("[_1] ([_2]) by [_3]", $attach->CreatedAsString, $attach->FriendlyContentLength, $m->scomp('/Elements/ShowUser', User => $attach->CreatorObj)) |n %>
     </label>
 <%perl>
 my $url = sprintf '%s/Ticket/Attachment/%d/%d/%s',

commit 24b80c26bbdfd6aefdf04e5d10a45e59cc13ca3f
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Sat Oct 3 02:03:36 2015 +0800

    take care of attachments that use external storage

diff --git a/share/html/Ticket/Elements/AddAttachments b/share/html/Ticket/Elements/AddAttachments
index 27e0eec..d31352d 100644
--- a/share/html/Ticket/Elements/AddAttachments
+++ b/share/html/Ticket/Elements/AddAttachments
@@ -166,7 +166,7 @@ jQuery( function() {
       <% loc("[_1] ([_2]) by [_3]", $attach->CreatedAsString, $attach->FriendlyContentLength, $m->scomp('/Elements/ShowUser', User => $attach->CreatorObj)) |n %>
     </label>
 <%perl>
-my $url = sprintf '%s/Ticket/Attachment/%d/%d/%s',
+my $url = RT->System->ExternalStorageURLFor($attach) || sprintf '%s/Ticket/Attachment/%d/%d/%s',
             RT->Config->Get('WebPath'), $attach->TransactionObj->Id, $attach->Id,
             $m->interp->apply_escapes($attach->Filename, 'u');
 </%perl>

-----------------------------------------------------------------------


More information about the rt-commit mailing list