[Rt-commit] rt branch, 3.999-trunk, updated. d4c67a64157d943c6c7135da168fd1c0ecbf091d

? sunnavy sunnavy at bestpractical.com
Mon Apr 5 08:27:45 EDT 2010


The branch, 3.999-trunk has been updated
       via  d4c67a64157d943c6c7135da168fd1c0ecbf091d (commit)
       via  29dd3f7c92352275facdbf25a3c7b0231e69bee8 (commit)
      from  23817d3d019b54ba90f4c6ee5e21a47bb16127c2 (commit)

Summary of changes:
 share/html/Ticket/Display.html |  119 ++++++++++++++--------------------------
 t/web/command_line.t           |    5 +-
 2 files changed, 42 insertions(+), 82 deletions(-)

- Log -----------------------------------------------------------------
commit 29dd3f7c92352275facdbf25a3c7b0231e69bee8
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Mon Apr 5 15:59:08 2010 +0800

    Display.html doesn't handle ticket create thing any more

diff --git a/share/html/Ticket/Display.html b/share/html/Ticket/Display.html
index a9731fd..83069fd 100755
--- a/share/html/Ticket/Display.html
+++ b/share/html/Ticket/Display.html
@@ -114,87 +114,50 @@ unless ($id || $ticket_obj) {
     abort('No ticket specified');
 }
 
-if ($ARGS{'id'} eq 'new') {
-    # {{{ Create a new ticket
-
-    my $queue = RT::Model::Queue->new( current_user => Jifty->web->current_user );
-    $queue->load($ARGS{'queue'});
-    unless ( $queue->id ) {
-        abort('Queue not found');
-    }
-
-    unless ( $queue->current_user_has_right('CreateTicket') ) {
-        abort('You have no permission to create tickets in that queue.');
+$ticket_obj ||= load_ticket($id);
+
+$m->callback( callback_name => 'BeforeProcessArguments',
+    ticket_obj => $ticket_obj, tickets => $Tickets,
+    ActionsRef => \@Actions, args_ref => \%ARGS );
+if ( defined $ARGS{'action'} ) {
+    if ($ARGS{'action'} =~ /^(steal|kill|take|set_told)$/) {
+        my $action = $1;
+        my ($res, $msg) = $ticket_obj->$action();
+        push(@Actions, $msg);
     }
+}
 
-    ($ticket_obj, @Actions) = create_ticket(
-        Attachments => Jifty->web->session->get('Attachments'),
-        %ARGS,
+$m->callback(callback_name => 'ProcessArguments', 
+        ticket => $ticket_obj, 
+        args_ref => \%ARGS, 
+        actions => \@Actions);
+
+$ARGS{update_attachments} = Jifty->web->session->get('Attachments');
+push @Actions,
+    process_update_message(
+    args_ref   => \%ARGS,
+    actions   => \@Actions,
+    ticket_obj => $ticket_obj,
     );
-    Jifty->web->session->remove('Attachments');
-
-#XXX bloody hack, should have a better way
-    my %cf_args;
-    for my $arg ( keys %ARGS ) {
-        if ( $arg =~ /J:A:F-(\d+)-edit-ticket-cfs/ ) {
-            $cf_args{$1} = $ARGS{$arg};
-        }
-    }
-    my $cf_action = RT::Action::EditTicketCFs->new( arguments => { id =>
-            $ticket_obj->id, %cf_args } );
-    $cf_action->take_action;
-
-    unless ( $ticket_obj->current_user_has_right('ShowTicket') ) {
-        abort("No permission to view newly Created ticket #".$ticket_obj->id.".");
-    }
-    # }}}
-} else { 
-    $ticket_obj ||= load_ticket($id);
-
-    $m->callback( callback_name => 'BeforeProcessArguments',
-        ticket_obj => $ticket_obj, tickets => $Tickets,
-        ActionsRef => \@Actions, args_ref => \%ARGS );
-    if ( defined $ARGS{'action'} ) {
-        if ($ARGS{'action'} =~ /^(steal|kill|take|set_told)$/) {
-            my $action = $1;
-            my ($res, $msg) = $ticket_obj->$action();
-            push(@Actions, $msg);
-        }
-    }
-
-    $m->callback(callback_name => 'ProcessArguments', 
-            ticket => $ticket_obj, 
-            args_ref => \%ARGS, 
-            actions => \@Actions);
-    
-    $ARGS{update_attachments} = Jifty->web->session->get('Attachments');
-    push @Actions,
-        process_update_message(
-        args_ref   => \%ARGS,
-        actions   => \@Actions,
-        ticket_obj => $ticket_obj,
-        );
-    Jifty->web->session->remove('Attachments');
-
-    #Process status updates
-    push @Actions, process_ticket_watchers(args_ref => \%ARGS, ticket_obj => $ticket_obj);
-    push @Actions, process_ticket_basics(args_ref => \%ARGS, ticket_obj => $ticket_obj);
-    push @Actions, process_ticket_links(args_ref => \%ARGS, ticket_obj => $ticket_obj);
-    push @Actions, process_ticket_dates(args_ref => \%ARGS, ticket_obj => $ticket_obj);
-    push @Actions, process_object_custom_field_updates(args_ref => \%ARGS, ticket_obj => $ticket_obj);
-
-    # XXX: we shouldn't block actions here if user has no right to see the ticket,
-    # but we should allow him to see actions he has done
-    unless ($ticket_obj->current_user_has_right('ShowTicket')) {
-        abort("No permission to view ticket");
-    }
-    if ( $ARGS{'mark_as_seen'} ) {
-        $ticket_obj->set_attribute(
-            name => 'User-'. $ticket_obj->current_user->id .'-SeenUpTo',
-            content => $ticket_obj->last_updated,
-        );
-        push @Actions, _('Marked all messages as seen');
-    }
+Jifty->web->session->remove('Attachments');
+
+#Process status updates
+push @Actions, process_ticket_watchers(args_ref => \%ARGS, ticket_obj => $ticket_obj);
+push @Actions, process_ticket_basics(args_ref => \%ARGS, ticket_obj => $ticket_obj);
+push @Actions, process_ticket_links(args_ref => \%ARGS, ticket_obj => $ticket_obj);
+push @Actions, process_ticket_dates(args_ref => \%ARGS, ticket_obj => $ticket_obj);
+push @Actions, process_object_custom_field_updates(args_ref => \%ARGS, ticket_obj => $ticket_obj);
+# XXX: we shouldn't block actions here if user has no right to see the ticket,
+# but we should allow him to see actions he has done
+unless ($ticket_obj->current_user_has_right('ShowTicket')) {
+    abort("No permission to view ticket");
+}
+if ( $ARGS{'mark_as_seen'} ) {
+    $ticket_obj->set_attribute(
+        name => 'User-'. $ticket_obj->current_user->id .'-SeenUpTo',
+        content => $ticket_obj->last_updated,
+    );
+    push @Actions, _('Marked all messages as seen');
 }
 
 $m->callback(

commit d4c67a64157d943c6c7135da168fd1c0ecbf091d
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Mon Apr 5 20:27:33 2010 +0800

    tests fix

diff --git a/t/web/command_line.t b/t/web/command_line.t
index 0c41879..9db50e2 100644
--- a/t/web/command_line.t
+++ b/t/web/command_line.t
@@ -3,7 +3,7 @@
 use strict;
 use Test::Expect;
 use File::Spec ();
-use RT::Test strict => 1, tests => 244, l10n => 1;
+use RT::Test strict => 1, tests => 243, l10n => 1;
 
 my ($baseurl, $m) = RT::Test->started_ok;
 ok( $m->login, 'login' );
@@ -117,8 +117,6 @@ ok($val,$msg);
     check_attachment($test_email);
     # binary attachment
     check_attachment(RT->static_path.'/images/bplogo.gif');
-    #XXX TODO this is not so right warning
-    $m->warnings_like( qr/Encode::Guess failed/ );
 
 # change a ticket's Owner
 expect_send("edit ticket/$ticket_id set owner=root", 'Changing owner...');
@@ -476,7 +474,6 @@ sub check_attachment {
     close $fh;
     $attachment_content =~ s/^\n*//;
     $attachment_content =~ s/\n*$//;
-    $attachment_content = encode( 'utf8', $attachment_content ); # jifty output is utf8 encoded
     expect_is($attachment_content,"Attachment contains original text");
 }
 

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


More information about the Rt-commit mailing list