[Rt-commit] rtir branch 5.0/external-feed-better-log created. 5.0.3-39-gaf88b303

BPS Git Server git at git.bestpractical.com
Thu May 4 13:32:18 UTC 2023


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/external-feed-better-log has been created
        at  af88b3030dd312840e00d3b9619eb17845188390 (commit)

- Log -----------------------------------------------------------------
commit af88b3030dd312840e00d3b9619eb17845188390
Author: Ronaldo Richieri <ronaldo at bestpractical.com>
Date:   Thu May 4 10:31:00 2023 -0300

    Improve External Feeds message when no content found
    
    External Feeds page was throwing a parse error when no content was found.
    This commit improves the message to be more user friendly.

diff --git a/lib/RT/IR/ExternalFeeds.pm b/lib/RT/IR/ExternalFeeds.pm
index 9ee7847e..f83b41d5 100644
--- a/lib/RT/IR/ExternalFeeds.pm
+++ b/lib/RT/IR/ExternalFeeds.pm
@@ -109,8 +109,10 @@ sub _parse_rss_feed {
     my ($self, $response) = @_;
     return { __error => "Can't reach feed : " . $response->status_line } unless ($response->is_success);
     eval { $self->{_rss_parser}->parse($response->content); };
-    unless ( $self->{_rss_parser}{channel}{title} && $self->{_rss_parser}{items}[0] ) {
+    unless ( $self->{_rss_parser}{channel}{title} ) {
         return { __error => "Couldn't parse RSS response "};
+    } elsif ( !$self->{_rss_parser}{items}[0] ) {
+        return { __error => "There is no recent content for this feed" };
     }
 
     my $parsed_feed = { map { ucfirst($_) => $self->{_rss_parser}{channel}{$_} }

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


hooks/post-receive
-- 
rtir


More information about the rt-commit mailing list