[Rt-commit] rt branch 5.0/make-config-history-more-readable created. rt-5.0.2-64-g2b3b5dd78a

BPS Git Server git at git.bestpractical.com
Mon Jan 31 19:19:50 UTC 2022


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rt".

The branch, 5.0/make-config-history-more-readable has been created
        at  2b3b5dd78abeb54b5654257ae92fc3968f1dc8e7 (commit)

- Log -----------------------------------------------------------------
commit 2b3b5dd78abeb54b5654257ae92fc3968f1dc8e7
Author: Brad Embree <brad at bestpractical.com>
Date:   Mon Jan 31 11:17:09 2022 -0800

    Adjust tests to account for new brief descriptions of SetConfig transactions

diff --git a/t/web/admin_tools_editconfig.t b/t/web/admin_tools_editconfig.t
index 366bf7f596..efba81a009 100644
--- a/t/web/admin_tools_editconfig.t
+++ b/t/web/admin_tools_editconfig.t
@@ -128,7 +128,7 @@ sub check_history_page_item {
     } else {
         $m->text_contains($change->{new_value});
     }
-    $m->text_contains("$change->{setting} changed", 'fetched tx has changed field');
+    $m->text_like(qr/$change->{setting} [added|changed|deleted]/, 'fetched tx has changed field');
 }
 
 sub compactify {

commit 5cb63c0be3511a42b02f6b0f905547229b3c706e
Author: Brad Embree <brad at bestpractical.com>
Date:   Mon Jan 31 10:39:27 2022 -0800

    Add logic to handle SetConfig transactions in same way as custom text field change transactions

diff --git a/share/html/Elements/ShowTransaction b/share/html/Elements/ShowTransaction
index a90c767338..3cddf17cf6 100644
--- a/share/html/Elements/ShowTransaction
+++ b/share/html/Elements/ShowTransaction
@@ -83,18 +83,40 @@ $m->comp(
 ) if $ShowBody;
 </%PERL>
   </div>
-% if ($Transaction->Type eq 'CustomField' && $Transaction->Field ) {
+% if ( ( $Transaction->Type eq 'CustomField' && $Transaction->Field ) or ( $Transaction->Type eq 'SetConfig' ) ) {
 %     my ($old, $new);
 %     my $cf = RT::CustomField->new( $session{CurrentUser} );
 %     $cf->SetContextObject( $Transaction->Object );
 %     $cf->Load( $Transaction->Field );
-%     if ($cf->Id && $cf->Type =~ /text/i) {
+%     if ( ( $cf->Id && $cf->Type =~ /text/i ) ) {
 %        $old = $Transaction->OldValue // loc('(no value)');
 %        $old = $m->comp('/Elements/ScrubHTML', Content => $old);
 %        $old =~ s|\n|<br />|g;
 %        $new = $Transaction->NewValue // loc('(no value)');
 %        $new = $m->comp('/Elements/ScrubHTML', Content => $new);
 %        $new =~ s|\n|<br />|g;
+%     }
+%     elsif ( $Transaction->Type eq 'SetConfig' ) {
+%         # pull in new value from reference if exists
+%         if ( $Transaction->NewReference ) {
+%             my $newobj = RT::Configuration->new($Transaction->CurrentUser);
+%             $newobj->Load($Transaction->NewReference);
+%             $new = $newobj->Content;
+%         }
+%         else {
+%             $new = loc('(no value)');
+%         }
+%         # pull in old value from reference if exists
+%         if ( $Transaction->OldReference ) {
+%             my $oldobj = RT::Configuration->new($Transaction->CurrentUser);
+%             $oldobj->Load($Transaction->OldReference);
+%             $old = $oldobj->Content // loc('(no value)');
+%         }
+%         else {
+%             $old = loc('(no value)');
+%         }
+%     }
+%     if ( $old || $new ) {
 <div class="details hidden" id="txn-<% $Transaction->Id %>-details">
 % if ( $old eq loc('(no value)')  ) {
   <div class="form-row">
@@ -215,6 +237,9 @@ elsif ($txn_type eq 'CustomField' && $Transaction->Field) {
         push @actions, { class => 'toggle-txn-details', title => loc('Show Details'), path => '#' };
     }
 }
+elsif ($txn_type eq 'SetConfig') {
+    push @actions, { class => 'toggle-txn-details', title => loc('Show Details'), path => '#' };
+}
 # If the transaction has anything attached to it at all
 elsif ( %$Attachments && $ShowActions ) {
     my %has_right = map {

commit 66fa878fac40573a2230ab9c06dbdeced794e199
Author: Brad Embree <brad at bestpractical.com>
Date:   Mon Jan 31 10:28:21 2022 -0800

    Change brief description logic for SetConfig transactions

diff --git a/lib/RT/Transaction.pm b/lib/RT/Transaction.pm
index e6a5746ce0..7a0173544b 100644
--- a/lib/RT/Transaction.pm
+++ b/lib/RT/Transaction.pm
@@ -1429,10 +1429,15 @@ sub _CanonicalizeRoleName {
             my $oldobj = RT::Configuration->new($self->CurrentUser);
             $oldobj->Load($self->OldReference);
             $old_value = $oldobj->Content;
-            return ('[_1] changed from "[_2]" to "[_3]"', $self->Field, $old_value // '', $new_value // ''); #loc()
         }
-        else {
-            return ('[_1] changed to "[_2]"', $self->Field, $new_value // ''); #loc()
+
+        if ( ! defined($old_value) || ( $old_value eq '' ) ) {
+            return ( "[_1] added", $self->Field );   #loc()
+        }
+        if ( ! defined($new_value) || ( $new_value eq '' ) ) {
+            return ( "[_1] deleted", $self->Field );   #loc()
+        } else {
+            return ( "[_1] changed", $self->Field );   #loc()
         }
     },
     DeleteConfig => sub  {

commit dff2448a715a9aae62893c1424faf8bd16a8f74a
Author: Brad Embree <brad at bestpractical.com>
Date:   Mon Jan 31 10:26:23 2022 -0800

    Add javascript for toggling transaction details

diff --git a/share/html/Admin/Tools/ConfigHistory.html b/share/html/Admin/Tools/ConfigHistory.html
index 9d0c40b127..67ba8a3951 100644
--- a/share/html/Admin/Tools/ConfigHistory.html
+++ b/share/html/Admin/Tools/ConfigHistory.html
@@ -77,3 +77,10 @@ $Transactions->OrderBy(FIELD => 'Created', ORDER => 'DESC');
   </div>
  </&>
 </div>
+<script type="text/javascript">
+jQuery(function() {
+    jQuery('.transaction .toggle-txn-details').click(function () {
+        return toggleTransactionDetails.apply(this);
+    });
+});
+</script>

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


hooks/post-receive
-- 
rt


More information about the rt-commit mailing list