[Bps-public-commit] RT-Extension-rt_cpan_org branch, master, updated. 8f05077e01f53f9dfc4db7fb6f9b5ae0d2323958

Thomas Sibley trs at bestpractical.com
Thu May 16 00:46:57 EDT 2013


The branch, master has been updated
       via  8f05077e01f53f9dfc4db7fb6f9b5ae0d2323958 (commit)
      from  f6a488a948af461463e7a1c99ec9efa3e215ff01 (commit)

Summary of changes:
 patches/4.0.14-attachment-ordering.patch | 58 ++++++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)
 create mode 100644 patches/4.0.14-attachment-ordering.patch

- Log -----------------------------------------------------------------
commit 8f05077e01f53f9dfc4db7fb6f9b5ae0d2323958
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Wed May 15 21:46:39 2013 -0700

    Patch for attachment ordering

diff --git a/patches/4.0.14-attachment-ordering.patch b/patches/4.0.14-attachment-ordering.patch
new file mode 100644
index 0000000..34cc6f6
--- /dev/null
+++ b/patches/4.0.14-attachment-ordering.patch
@@ -0,0 +1,58 @@
+From 8dea1161afae6b5822c002abe5e7e04f4cf3e993 Mon Sep 17 00:00:00 2001
+From: Thomas Sibley <trs at bestpractical.com>
+Date: Tue, 14 May 2013 16:34:59 -0700
+Subject: [PATCH] Display and add attachments in alphabetical order by name
+
+Without any sorting, the ordering is random and determined by Perl's
+internal hash key/value ordering.  While preserving upload order would
+probably be best for the cases touched in this commit, it would require
+a more invasive or hackish change not suitable for the 4.0 series.
+
+We already display attachments in alphabetical order in the ticket
+metadata.  Extend that same consistent ordering to the attachments list
+during ticket create/update and when adding the attachments to the
+create/update MIME entity.
+---
+ lib/RT/Interface/Web.pm                   | 5 +++--
+ share/html/Ticket/Elements/AddAttachments | 2 +-
+ 2 files changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
+index ba7b56d..dce1117 100644
+--- a/lib/RT/Interface/Web.pm
++++ b/lib/RT/Interface/Web.pm
+@@ -1754,7 +1754,7 @@ sub CreateTicket {
+         $RT::Logger->error("Couldn't make multipart message")
+             if !$rv || $rv !~ /^(?:DONE|ALREADY)$/;
+ 
+-        foreach ( values %{ $ARGS{'Attachments'} } ) {
++        foreach ( map $ARGS{Attachments}->{$_}, sort keys %{ $ARGS{'Attachments'} } ) {
+             unless ($_) {
+                 $RT::Logger->error("Couldn't add empty attachemnt");
+                 next;
+@@ -1987,7 +1987,8 @@ sub ProcessUpdateMessage {
+ 
+     if ( $args{ARGSRef}->{'UpdateAttachments'} ) {
+         $Message->make_multipart;
+-        $Message->add_part($_) foreach values %{ $args{ARGSRef}->{'UpdateAttachments'} };
++        $Message->add_part($_) foreach map $args{ARGSRef}->{UpdateAttachments}{$_},
++                                  sort keys %{ $args{ARGSRef}->{'UpdateAttachments'} };
+     }
+ 
+     if ( $args{ARGSRef}->{'AttachTickets'} ) {
+diff --git a/share/html/Ticket/Elements/AddAttachments b/share/html/Ticket/Elements/AddAttachments
+index d00a021..cdf6281 100644
+--- a/share/html/Ticket/Elements/AddAttachments
++++ b/share/html/Ticket/Elements/AddAttachments
+@@ -49,7 +49,7 @@
+ <tr><td class="label"><&|/l&>Attached file</&>:</td>
+ <td>
+ <&|/l&>Check box to delete</&><br />
+-% foreach my $attach_name (keys %{$session{'Attachments'}}) {
++% foreach my $attach_name (sort keys %{$session{'Attachments'}}) {
+ <input type="checkbox" class="checkbox" name="DeleteAttach-<%$attach_name%>" value="1" /><%$attach_name%><br />
+ % } # end of foreach
+ </td>
+-- 
+1.8.2.2
+

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



More information about the Bps-public-commit mailing list