[Rt-commit] rtir branch 5.0/add-feed-callbacks-2 created. 5.0.1-2-gfd66d0f5

BPS Git Server git at git.bestpractical.com
Wed Oct 6 19:45:49 UTC 2021


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 "rtir".

The branch, 5.0/add-feed-callbacks-2 has been created
        at  fd66d0f512c75548e69062e5b267133372e746aa (commit)

- Log -----------------------------------------------------------------
commit fd66d0f512c75548e69062e5b267133372e746aa
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Fri Jul 23 14:28:28 2021 -0400

    Add callbacks to the feed listing and display pages
    
    This makes it possible for an extension to add a new
    feed to the existing page.

diff --git a/html/RTIR/Tools/ExternalFeeds.html b/html/RTIR/Tools/ExternalFeeds.html
index a99a30a8..733a9f4d 100644
--- a/html/RTIR/Tools/ExternalFeeds.html
+++ b/html/RTIR/Tools/ExternalFeeds.html
@@ -51,8 +51,9 @@
 <div class="form-row">
   <div class="col-12">
 % my $i = 0;
-% if ($FeedName) {
+% if ( $FeedName and $ExternalFeeds->{rss_feeds}{$FeedName} ) {
 %   my $feed = $ExternalFeeds->fetch_rss_feed($FeedName);
+
     <&|/Widgets/TitleBox,
       title => $feed->{Title},
       class => "external-feeds fullwidth",
@@ -111,13 +112,19 @@
       </div>
 %   }
   </&>
+% }
+% elsif ( $FeedName ) {
+% # Allow non-RSS feeds from extensions to run
+% $m->callback( CallbackName => 'DisplayFeedContent', %ARGS, FeedsObj => $ExternalFeeds, FeedName => $FeedName, Lifecycle => $Lifecycle );
 % } else {
+% my $found_feed;
+%   if ( $ExternalFeeds->have_rss_feeds) {
     <&|/Widgets/TitleBox,
         title => loc("RSS"),
         class => "fullwidth",
         bodyclass => ""
     &>
-%   if ( $ExternalFeeds->have_rss_feeds) {
+%       $found_feed = 1;
       <div class="table-responsive">
         <table cellspacing="0" class="table collection collection-as-table">
           <tr class="collection-as-table">
@@ -133,13 +140,15 @@
 %       }
         </table>
       </div>
+    </&>
 %   }
-%   else {
+% $m->callback( CallbackName => 'AfterFeedsList', %ARGS, FeedsObj => $ExternalFeeds, FoundFeedRef => \$found_feed );
+
+%   unless ( $found_feed ) {
       <p class="mt-3 mt-1 ml-3">
-        <&|/l&>No RSS feeds currently configured, you can configure feeds in the %ExternalFeeds option, a default set of security feeds is included in the inital RTIR configuration.</&>
+        <&|/l&>No feeds currently configured. You can configure feeds in the %ExternalFeeds option. A default set of security feeds is included in the inital RTIR configuration.</&>
       </p>
 %   }
-    </&>
 % }
 
   </div>
diff --git a/lib/RT/IR/ExternalFeeds.pm b/lib/RT/IR/ExternalFeeds.pm
index bf93895d..66112f9b 100644
--- a/lib/RT/IR/ExternalFeeds.pm
+++ b/lib/RT/IR/ExternalFeeds.pm
@@ -150,4 +150,6 @@ sub _scrub_html {
     return $scrubbed_html;
 }
 
+RT::IR->ImportOverlays;
+
 1;

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


hooks/post-receive
-- 
rtir


More information about the rt-commit mailing list