[Rt-commit] rt branch, 5.0/fix-slow-performance-for-custom-fields-with-many-values, created. rt-5.0.0-27-g4d20cec54b

? sunnavy sunnavy at bestpractical.com
Thu Oct 1 14:19:49 EDT 2020


The branch, 5.0/fix-slow-performance-for-custom-fields-with-many-values has been created
        at  4d20cec54b6349b202816d6c4c41d84415d37142 (commit)

- Log -----------------------------------------------------------------
commit 4d20cec54b6349b202816d6c4c41d84415d37142
Author: Dianne Skoll <dianne at bestpractical.com>
Date:   Wed Sep 30 09:58:33 2020 -0400

    Tweak logic to not generate to-be-deleted inline editing html
    
    Even if inline editing was disabled, the code was still fetching all
    custom field values for selection fields, which could slow down page
    load a lot if the custom field value list is big.
    
    Fixes: I#36776

diff --git a/share/html/Elements/CollectionAsTable/Row b/share/html/Elements/CollectionAsTable/Row
index aa1426fb92..6396b68b35 100644
--- a/share/html/Elements/CollectionAsTable/Row
+++ b/share/html/Elements/CollectionAsTable/Row
@@ -91,7 +91,11 @@ foreach my $column (@Format) {
     my $class = $column->{class} ? $m->interp->apply_escapes($column->{class}, 'h') : 'collection-as-table';
 
     my %attrs;
-    foreach my $attr (qw(style align edit)) {
+    my @possible_attrs = qw(style align);
+    if ($InlineEdit && $record->isa('RT::Ticket') && $record->CurrentUserHasRight('ModifyTicket')) {
+        push(@possible_attrs, 'edit');
+    }
+    foreach my $attr (@possible_attrs) {
         if ( defined $column->{ $attr } ) {
             $attrs{ $attr } = $column->{ $attr };
             next;
@@ -116,13 +120,6 @@ foreach my $column (@Format) {
         );
     }
 
-    delete $attrs{edit} if !$InlineEdit;
-
-    delete $attrs{edit} unless $record->isa('RT::Ticket');
-
-    delete $attrs{edit} if $record->isa('RT::Ticket')
-                        && !$record->CurrentUserHasRight('ModifyTicket');
-
     $attrs{colspan} = $column->{span};
     $item += ($attrs{'colspan'} || 1);
 

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


More information about the rt-commit mailing list