[Rt-commit] rt branch, 4.4/hide-time-worked, repushed
Dustin Graves
dustin at bestpractical.com
Tue Dec 1 13:44:19 EST 2015
The branch 4.4/hide-time-worked was deleted and repushed:
was 1cbf2cd8f1319b843fd9474d9211e31e5d797c4c
now 8bf5da95e570db1a3fb9a68f06f0786df7f28585
1: 1cbf2cd ! 1: 8bf5da9 add config HideTimeWorkedForUnprivilegedUsers to hide time worked, estimated, and left for unprivileged users
@@ -11,7 +11,7 @@
=back
-+=item C<$HideTimeWorkedForUnprivilegedUsers>
++=item C<$HideTimeFieldsFromUnprivilegedUsers>
+
+This determines if we should hide Time Worked, Time Estimated, and
+Time Left for unprivileged users.
@@ -19,13 +19,37 @@
+
+=cut
+
-+Set($HideTimeWorkedForUnprivilegedUsers, 0);
++Set($HideTimeFieldsFromUnprivilegedUsers, 0);
+
+=back
+
=head2 Articles
+
+diff --git a/lib/RT/Ticket.pm b/lib/RT/Ticket.pm
+--- a/lib/RT/Ticket.pm
++++ b/lib/RT/Ticket.pm
+@@
+ return ( $ret, $self->loc('Message recorded') );
+ }
+
++=head2 CurrentUserCanSeeTime
++
++Returns true if the current user can see time worked, estimated, left
++
++=cut
++
++sub CurrentUserCanSeeTime {
++ my $self = shift;
++
++ return $self->CurrentUser->Privileged ||
++ !RT->Config->Get('HideTimeFieldsFromUnprivilegedUsers');
++}
++
+ 1;
+
+ =head1 AUTHOR
diff --git a/share/html/Elements/ShowHistoryPage b/share/html/Elements/ShowHistoryPage
--- a/share/html/Elements/ShowHistoryPage
@@ -36,10 +60,9 @@
+ # Skip Time Worked fields if user is unprivileged and
+ # HideTimeWorkedForUnprivilegedUsers is set.
-+ $skip = 1 if $Object->isa("RT::Ticket") and
-+ ($Transaction->Field || '') =~ /(TimeEstimated|Worked|TimeLeft)/ and
-+ !$session{CurrentUser}->Privileged and
-+ RT->Config->Get('HideTimeWorkedForUnprivilegedUsers');
++ $skip = 1 if $Object->isa("RT::Ticket") and
++ not $Object->CurrentUserCanSeeTime and
++ ($Transaction->Field || '') =~ /^(?:TimeEstimated|Worked|TimeLeft)$/;
+
$m->callback(
%ARGS,
@@ -69,7 +92,7 @@
<%init>
my $time_worked;
-if ( $Ticket->TimeWorked ) {
-+my $show_time_worked = $session{CurrentUser}->Privileged || !RT->Config->Get('HideTimeWorkedForUnprivilegedUsers');
++my $show_time_worked = $Ticket->CurrentUserCanSeeTime;
+if ( $show_time_worked && $Ticket->TimeWorked ) {
my $time_worked_attr = $Ticket->FirstAttribute('TimeWorked');
More information about the rt-commit
mailing list