[Rt-commit] rt branch 5.0/validator-delete-dangling-attributes created. rt-5.0.2-258-ga1710f0737

BPS Git Server git at git.bestpractical.com
Fri Jun 3 19:18:04 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/validator-delete-dangling-attributes has been created
        at  a1710f0737d97ad1236c3330e8cc97a9577479c0 (commit)

- Log -----------------------------------------------------------------
commit a1710f0737d97ad1236c3330e8cc97a9577479c0
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Sat Jun 4 02:41:46 2022 +0800

    Support to delete dangling attributes
    
    In eb06b9aba1, we chose to bypass dangling "ContentHistory" attributes
    and related transactions. Old versions still report these records and
    allow user to delete transactions(but not attributes). If user uses an
    old version and chooses to delete these transactions, which rt-validator
    requires to find out dangling-but-allowed attributes, it will continue
    reporting these attributes(even with eb06b9aba1):
    
        Record #31 in Attributes references a nonexistent record in Attributes
          ObjectId => '30' => id
    
    This commit allows user to delete these attributes to clean things up.

diff --git a/sbin/rt-validator.in b/sbin/rt-validator.in
index 90d805a54e..ef3397c0b9 100644
--- a/sbin/rt-validator.in
+++ b/sbin/rt-validator.in
@@ -1034,6 +1034,13 @@ push @CHECKS, Attributes => sub {
                 "RT::$model",
                 ($model eq 'Attribute' ? @deleted_attributes_binds : ())
             ],
+            action => sub {
+                my $id = shift;
+                return unless prompt(
+                    'Delete', "Found an attribute without object."
+                );
+                delete_record( 'Attributes', $id );
+            },
         );
     }
     return $res;

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


hooks/post-receive
-- 
rt


More information about the rt-commit mailing list