[Rt-commit] rt branch 5.0/refactor-dashboard-subscriptions created. rt-5.0.2-115-g1c7eba2347

BPS Git Server git at git.bestpractical.com
Tue Apr 12 12:50:11 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/refactor-dashboard-subscriptions has been created
        at  1c7eba23473da1cf90cd80cfbaf0e3ecbf9ed4ea (commit)

- Log -----------------------------------------------------------------
commit 1c7eba23473da1cf90cd80cfbaf0e3ecbf9ed4ea
Author: Jason Crome <jcrome at bestpractical.com>
Date:   Wed Apr 6 14:36:45 2022 -0400

    Define subscription rows in component init
    
    The row options were originally hard-coded. By moving this to init, then
    iterating over the list of values will allow extensions to modify the
    settings in the MassageSubscriptionFields callback, where it wasn't
    possible before.

diff --git a/share/html/Dashboards/Subscription.html b/share/html/Dashboards/Subscription.html
index c5b631c74a..ab34ca23d5 100644
--- a/share/html/Dashboards/Subscription.html
+++ b/share/html/Dashboards/Subscription.html
@@ -230,7 +230,7 @@
       <div class="row">
         <div class="col-auto">
           <select name="Rows" class="form-control selectpicker">
-% for my $rows (1, 2, 5, 10, 15, 20, 25, 50, 75, 100, 0) {
+% for my $rows ( @{ $fields{ RowOptions } } ) {
             <option value="<% $rows %>" <% $fields{'Rows'} eq $rows ? 'selected="selected"' : '' |n %>><% loc($rows || 'Unlimited') %></option>
 % }
           </select>
@@ -332,6 +332,7 @@ my %fields = (
     Dow         => 'Monday',
     Dom         => 1,
     Rows        => 20,
+    RowOptions  => [1, 2, 5, 10, 15, 20, 25, 50, 75, 100, 0],
     Recipients  => { Users => [], Groups => [] },
     Fow         => 1,
     Counter     => 0,
@@ -339,13 +340,13 @@ my %fields = (
     SuppressIfEmpty => 0,
     Context     => 'subscriber',
 );
-
 $m->callback( %ARGS, CallbackName => 'SubscriptionFields', FieldsRef => \%fields,
      SubscriptionObj => $SubscriptionObj, DashboardObj => $Dashboard);
 
 # update any fields with the values from the subscription object
 if ($SubscriptionObj) {
     for my $field (keys %fields) {
+        next if $field eq 'RowOptions'; # immutable
         $fields{$field} = $SubscriptionObj->SubValue($field);
     }
 }

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


hooks/post-receive
-- 
rt


More information about the rt-commit mailing list