[Rt-commit] rt branch, update-action, updated. 2ecfca5748cc60a0614ae31adf3d6ce09c64a915

sartak at bestpractical.com sartak at bestpractical.com
Fri Jan 15 17:40:25 EST 2010


The branch, update-action has been updated
       via  2ecfca5748cc60a0614ae31adf3d6ce09c64a915 (commit)
       via  7931127e015708c5a9ac70334213491997bd85c9 (commit)
       via  f184dfa1fbe788dcdf292b1d8f9ed2883b818b03 (commit)
       via  b1b73c07636c4089ab7e5d32880552824dff160f (commit)
       via  d77ae5221dd27e0372f861a8a4713a0f74f4ebdd (commit)
       via  28b85df66423f8855ef9a0ab1d3cabb9dec214f8 (commit)
       via  5c016dfbd506dd72242060721f20963abee06d36 (commit)
       via  8b69e3b582a7a2511dd3c90168481d299fc2d8c6 (commit)
      from  a8d9cfc308826e6df1b64ad1fe5bcee4c8a521b0 (commit)

Summary of changes:
 Makefile.PL                    |    2 +-
 lib/RT/Action/CreateTicket.pm  |    2 +-
 lib/RT/Action/QueueBased.pm    |   12 ++++++++++++
 lib/RT/Action/UpdateTicket.pm  |   19 ++++++++-----------
 lib/RT/Dispatcher.pm           |    2 +-
 share/html/Ticket/Display.html |   11 +++++++++--
 t/ticket/requestor-order.t     |   16 +++-------------
 7 files changed, 35 insertions(+), 29 deletions(-)

- Log -----------------------------------------------------------------
commit 5c016dfbd506dd72242060721f20963abee06d36
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Fri Jan 15 14:39:23 2010 -0500

    owner default has to be an arrayref

diff --git a/lib/RT/Action/CreateTicket.pm b/lib/RT/Action/CreateTicket.pm
index 6a924d4..4c9bc8c 100644
--- a/lib/RT/Action/CreateTicket.pm
+++ b/lib/RT/Action/CreateTicket.pm
@@ -16,7 +16,7 @@ use Jifty::Action schema {
     param owner =>
         render as 'RT::View::Form::Field::SelectUser',
         # valid_values are queue-specific
-        valid_values are lazy { RT->nobody->id },
+        valid_values are lazy { [ RT->nobody->id ] },
         label is _('Owner');
 
     param subject =>
diff --git a/lib/RT/Action/UpdateTicket.pm b/lib/RT/Action/UpdateTicket.pm
index f6d55fb..437e179 100644
--- a/lib/RT/Action/UpdateTicket.pm
+++ b/lib/RT/Action/UpdateTicket.pm
@@ -16,7 +16,7 @@ use Jifty::Action schema {
     param owner =>
         render as 'RT::View::Form::Field::SelectUser',
         # valid_values are queue-specific
-        valid_values are lazy { RT->nobody->id },
+        valid_values are lazy { [ RT->nobody->id ] },
         label is _('Owner');
 
     param subject =>

commit 28b85df66423f8855ef9a0ab1d3cabb9dec214f8
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Fri Jan 15 14:42:47 2010 -0500

    Better id-plucking logic for action results

diff --git a/share/html/Ticket/Display.html b/share/html/Ticket/Display.html
index b2871f8..a9731fd 100755
--- a/share/html/Ticket/Display.html
+++ b/share/html/Ticket/Display.html
@@ -95,8 +95,15 @@ $collapsed => undef
 
 <%INIT>
 
-$id ||= Jifty->web->response->result('create_ticket')->content('id')
-    ||  Jifty->web->response->result('modify_ticket')->content('id');
+# if the user didn't pass in an id, guess it based on action results
+if (!$id) {
+    if (my $create_result = Jifty->web->response->result('create_ticket')) {
+        $id = $create_result->content('id')
+    }
+    elsif (my $modify_result = Jifty->web->response->result('modify_ticket')) {
+        $id = $modify_result->content('id')
+    }
+}
 
 $m->callback( ticket_obj => $ticket_obj, args_ref => \%ARGS, callback_name => 'Initial' );
 

commit d77ae5221dd27e0372f861a8a4713a0f74f4ebdd
Merge: 28b85df 8b69e3b
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Fri Jan 15 15:14:41 2010 -0500

    Merge branch '3.999-trunk' into update-action


commit b1b73c07636c4089ab7e5d32880552824dff160f
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Fri Jan 15 15:56:09 2010 -0500

    Warn if we never find a queue for the queue-based action

diff --git a/lib/RT/Action/QueueBased.pm b/lib/RT/Action/QueueBased.pm
index 306734a..ca0146a 100644
--- a/lib/RT/Action/QueueBased.pm
+++ b/lib/RT/Action/QueueBased.pm
@@ -42,6 +42,10 @@ sub arguments {
             $queue = $queue->[0] if ref $queue eq 'ARRAY';
             $self->set_queue($queue);
         }
+
+        if (!$queue) {
+            warn "No queue found for $self";
+        }
     }
 
     return $self->{_cached_arguments};

commit f184dfa1fbe788dcdf292b1d8f9ed2883b818b03
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Fri Jan 15 15:58:24 2010 -0500

    Pluck the queue out of the record if we have one

diff --git a/lib/RT/Action/QueueBased.pm b/lib/RT/Action/QueueBased.pm
index ca0146a..852896a 100644
--- a/lib/RT/Action/QueueBased.pm
+++ b/lib/RT/Action/QueueBased.pm
@@ -35,17 +35,25 @@ sub arguments {
         # after_set_queue to be called twice, and that leads to a lot of
         # duplicate work and possibly duplicate data.
         my $already_setting_queue = (caller(1))[3] eq __PACKAGE__.'::set_queue';
+
+        # if we have a queue argument, use it
         my $action = Jifty->web->request->action($self->moniker);
         my $queue = $action ? $action->argument('queue') : 0;
 
-        if (!$already_setting_queue && $queue) {
-            $queue = $queue->[0] if ref $queue eq 'ARRAY';
-            $self->set_queue($queue);
+        # otherwise, try to pluck the queue from the record if we have one
+        if (!$queue && $self->can('record')) {
+            $queue = $self->record->queue_id;
         }
 
         if (!$queue) {
             warn "No queue found for $self";
         }
+
+        # run set_queue logic
+        if (!$already_setting_queue && $queue) {
+            $queue = $queue->[0] if ref $queue eq 'ARRAY';
+            $self->set_queue($queue);
+        }
     }
 
     return $self->{_cached_arguments};

commit 7931127e015708c5a9ac70334213491997bd85c9
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Fri Jan 15 16:00:48 2010 -0500

    The moniker is modify_ticket not update_ticket

diff --git a/lib/RT/Dispatcher.pm b/lib/RT/Dispatcher.pm
index 6a38504..474c9a2 100644
--- a/lib/RT/Dispatcher.pm
+++ b/lib/RT/Dispatcher.pm
@@ -748,7 +748,7 @@ on '/ticket/create' => run {
 };
 
 on '/ticket/modify' => run {
-    my $action = Jifty->web->request->action('update_ticket');
+    my $action = Jifty->web->request->action('modify_ticket');
     my $id = $action ? $action->argument('id') : get('id');
     if (!defined($id)) {
         die "no ticket selected";

commit 2ecfca5748cc60a0614ae31adf3d6ce09c64a915
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Fri Jan 15 16:05:48 2010 -0500

    Don't cache the combined arguments for now

diff --git a/lib/RT/Action/UpdateTicket.pm b/lib/RT/Action/UpdateTicket.pm
index 437e179..8218ca1 100644
--- a/lib/RT/Action/UpdateTicket.pm
+++ b/lib/RT/Action/UpdateTicket.pm
@@ -28,19 +28,16 @@ use Jifty::Action schema {
 
 sub arguments {
     my $self = shift;
-    return $self->Jifty::Action::Record::Update::arguments(@_);
 
-    if (!$self->{_cached_arguments}) {
-        my $ticket_args = $self->RT::Action::TicketAction::arguments(@_);
-        my $update_args = $self->Jifty::Action::Record::Update::arguments(@_);
+    my $update_args = $self->Jifty::Action::Record::Update::arguments(@_);
+    my $ticket_args = $self->RT::Action::TicketAction::arguments(@_);
 
-        $self->{_cached_arguments} = Jifty::Param::Schema::merge_params(
-            $update_args,
-            $ticket_args,
-        );
-    }
+    my $combined_args = Jifty::Param::Schema::merge_params(
+        $update_args,
+        $ticket_args,
+    );
 
-    return $self->{_cached_arguments};
+    return $combined_args;
 }
 
 sub _valid_statuses {

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


More information about the Rt-commit mailing list