[Bps-public-commit] SD branch, master, updated. c60c11f6de4ec36548af8de48be08bfe900454bf

jesse jesse at bestpractical.com
Fri Aug 7 09:37:43 EDT 2009


The branch, master has been updated
       via  c60c11f6de4ec36548af8de48be08bfe900454bf (commit)
       via  abf990efc2578eb9715c67e818754f0a743238f9 (commit)
      from  47b999d0e4c971867748dd079bcb11705e029217 (commit)

Summary of changes:
 lib/App/SD/Server/Dispatcher.pm |   16 ++++++++++++++++
 lib/App/SD/Server/View.pm       |    4 ++--
 2 files changed, 18 insertions(+), 2 deletions(-)

- Log -----------------------------------------------------------------
commit abf990efc2578eb9715c67e818754f0a743238f9
Author: Jesse Vincent <jesse at bestpractical.com>
Date:   Fri Aug 7 14:28:50 2009 +0100

    quiet down warning s when someoen tries to display history of a deleted
    ticket

diff --git a/lib/App/SD/Server/View.pm b/lib/App/SD/Server/View.pm
index e2cff4d..675447e 100644
--- a/lib/App/SD/Server/View.pm
+++ b/lib/App/SD/Server/View.pm
@@ -490,7 +490,7 @@ content {
 
                 h2 {
                     a {{ href is '/ticket/' . $ticket->uuid; class is 'ticket-summary'; }; $ticket->prop('summary') };
-                   span { { class is 'ticket-id'};  ' (' . $ticket->luid . ')'};
+                   span { { class is 'ticket-id'};  ' (' . ($ticket->luid || '') . ')'};
                 }
             } elsif ($change->record_type eq 'comment') {
                 my $ticket = App::SD::Model::Ticket->new(
@@ -510,7 +510,7 @@ content {
                 h2 {
                      outs('Comment on: ');
                      a {{ href is '/ticket/' . $ticket->uuid; class is 'ticket-summary'; }; $ticket->prop('summary') };
-                   span { { class is 'ticket-id'};  ' (' . $ticket->luid . ')'};
+                   span { { class is 'ticket-id'};  ' (' . ($ticket->luid ||''). ')'};
                 }
 
 

commit c60c11f6de4ec36548af8de48be08bfe900454bf
Author: Jesse Vincent <jesse at bestpractical.com>
Date:   Fri Aug 7 14:29:16 2009 +0100

    Add a dispatcher rule to 404 on trying to view a non-existant ticket

diff --git a/lib/App/SD/Server/Dispatcher.pm b/lib/App/SD/Server/Dispatcher.pm
index 9836bbb..2354620 100644
--- a/lib/App/SD/Server/Dispatcher.pm
+++ b/lib/App/SD/Server/Dispatcher.pm
@@ -79,6 +79,22 @@ under { method => 'GET' } => sub {
         };
 
         on 'new'                 => sub { shift->show_template('new_ticket') };
+        on qr'^([\w\d-]+)/?'    => sub {
+		my $self = shift;
+		my $id = $1;
+
+        my $ticket = App::SD::Model::Ticket->new(
+            app_handle => $self->server->app_handle,
+            handle     => $self->server->app_handle->handle
+        );
+        $ticket->load(($id =~ /^\d+$/ ? 'luid' : 'uuid') =>$id);
+			if (!$ticket->luid) {
+
+				$self->server->_send_404(); #redirect( to => "/error/ticket_does_not_exist");
+			}	else {
+				next_rule;
+				}
+		};
         on qr'^([\w\d-]+)/?$'    => sub { shift->server->_send_redirect( to => "/ticket/$1/view" ) };
         on qr'^([\w\d-]+)/edit$' => sub { shift->show_template( 'edit_ticket', $1 ) };
         on qr'^([\w\d-]+)/history$' => sub { shift->show_template( 'show_ticket_history', $1 ) };

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



More information about the Bps-public-commit mailing list