[Rt-commit] rt branch, create-action, updated. 70628d3a7514369ad65eb1b18cfddaaed3553c00

sartak at bestpractical.com sartak at bestpractical.com
Wed Sep 2 08:40:32 EDT 2009


The branch, create-action has been updated
       via  70628d3a7514369ad65eb1b18cfddaaed3553c00 (commit)
      from  217076d73d04f06c04d15b83c1ac91e1ba6b6194 (commit)

Summary of changes:
 lib/RT/Action/QueueBased.pm |   19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)

- Log -----------------------------------------------------------------
commit 70628d3a7514369ad65eb1b18cfddaaed3553c00
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Wed Sep 2 08:40:01 2009 -0400

    Handle the two cases of set_queue vs plucking queue out of the request

diff --git a/lib/RT/Action/QueueBased.pm b/lib/RT/Action/QueueBased.pm
index a7a5173..7eaf0ef 100644
--- a/lib/RT/Action/QueueBased.pm
+++ b/lib/RT/Action/QueueBased.pm
@@ -16,7 +16,19 @@ sub arguments {
     if (!$self->{_cached_arguments}) {
         $self->{_cached_arguments} = \%{ $self->PARAMS };
 
-        if (Jifty->web->request->argument('queue')) {
+        # The two cases are:
+        # 1. Some template called set_queue on this action. The template
+        #    has told us which queue to use. We do not want to guess the
+        #    queue based on request parameters. We also do not want to call
+        #    set_queue since set_queue is already doing its thing.
+        # 2. Jifty inspected this action's arguments and we are plucking
+        #    the queue out of the request. We need to call set_queue to
+        #    inform the rest of the arguments of the queue so they can
+        #    adjust valid values, etc.
+        # We do not want to call set_queue twice.
+        my $already_setting_queue = caller eq __PACKAGE__ && (caller)[3] eq 'set_queue';
+
+        if (!$already_setting_queue && Jifty->web->request->argument('queue')) {
             my $queue = Jifty->web->request->argument('queue');
             $queue = $queue->[0] if ref $queue eq 'ARRAY';
             $self->set_queue($queue);
@@ -36,6 +48,11 @@ sub set_queue {
         $queue = $queue_obj;
     }
 
+    # Prep the arguments cache
+    $self->arguments if !$self->{_cached_arguments};
+
+    $self->{_cached_arguments}{queue}{default_value} = $queue->name;
+
     $self->after_set_queue($queue);
 
     return $queue;

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


More information about the Rt-commit mailing list