[Rt-commit] r8293 - in rt/branches/3.7-EXPERIMENTAL-TUNIS: . html/Ticket

thayes at bestpractical.com thayes at bestpractical.com
Wed Jul 25 17:34:32 EDT 2007


Author: thayes
Date: Wed Jul 25 17:34:32 2007
New Revision: 8293

Modified:
   rt/branches/3.7-EXPERIMENTAL-TUNIS/   (props changed)
   rt/branches/3.7-EXPERIMENTAL-TUNIS/html/Elements/ShowLock
   rt/branches/3.7-EXPERIMENTAL-TUNIS/html/Ticket/Display.html

Log:
 r8441 at toth:  toth | 2007-07-25 17:34:16 -0400
 * Improved messages for removed locks
 


Modified: rt/branches/3.7-EXPERIMENTAL-TUNIS/html/Elements/ShowLock
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL-TUNIS/html/Elements/ShowLock	(original)
+++ rt/branches/3.7-EXPERIMENTAL-TUNIS/html/Elements/ShowLock	Wed Jul 25 17:34:32 2007
@@ -1,7 +1,7 @@
-% if ($u->id == $session{'CurrentUser'}->id) {
+% if ($duration ||($u->id && $u->id == $session{'CurrentUser'}->id)) {
 <div class="locked-by-you">
 % if(defined $duration) {
-	<&|/l, $ago &>You had this ticket locked for [_1]. It is now unlocked.</&>.
+	<&|/l, $ago &>You had this ticket locked for [_1]. It is now unlocked</&>.
 % } else {
 	<&|/l, $ago &>You have had this ticket locked for [_1]</&>.
 % 		unless($ARGS{'noUnlock'}) {
@@ -16,16 +16,20 @@
 </div>
 %}
 <%init>
-return unless (my $Lock = $Ticket->Locked());
+my $Lock;
+return unless defined $duration || ($Lock = $Ticket->Locked());
+
 my $u = RT::User->new($session{'CurrentUser'});
-$u->Load($Lock->Content->{'User'});
+$u->Load($Lock->Content->{'User'}) if $Lock;
 
 my $date = RT::Date->new($session{'CurrentUser'});
 my $ago;
 if(defined $duration) {
 	$ago = $date->DurationAsString($duration);
-} else {
+} elsif($Lock) {
 	$ago = $date->DurationAsString(time() - $Lock->Content->{'Timestamp'});
+} else {
+	return;
 }
 </%init>
 <%args>

Modified: rt/branches/3.7-EXPERIMENTAL-TUNIS/html/Ticket/Display.html
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL-TUNIS/html/Ticket/Display.html	(original)
+++ rt/branches/3.7-EXPERIMENTAL-TUNIS/html/Ticket/Display.html	Wed Jul 25 17:34:32 2007
@@ -158,10 +158,9 @@
 
 			} elsif ( $lock->Content->{'User'} == $session{'CurrentUser'}->id ) {
 				$duration = time() - $lock->Content->{'Timestamp'};
-				my $date = RT::Date->new($session{'CurrentUser'});
-				$duration = $date->DurationAsString($duration);
+				$duration = time() - $lock->Content->{'Timestamp'};
 				$TicketObj->Unlock();
-				push @Actions, loc('You have unlocked this ticket (locked for ' . $duration . ')');
+                push @Actions, loc('You have unlocked this ticket');
 			} else {
 				push @Actions,
 					loc("You can't unlock tickets that you did not lock");


More information about the Rt-commit mailing list