[Cpan-forum-commit] rev 214 - in trunk: . lib/CPAN lib/CPAN/Forum/RM t/live

svn at pti.co.il svn at pti.co.il
Thu Aug 31 01:27:11 IDT 2006


Author: gabor
Date: 2006-08-31 01:27:11 +0300 (Thu, 31 Aug 2006)
New Revision: 214

Modified:
   trunk/
   trunk/lib/CPAN/Forum.pm
   trunk/lib/CPAN/Forum/RM/Notify.pm
   trunk/t/live/live.t
Log:
replace rss error message with an rss feed with one item
saying there is No post yet



Property changes on: trunk
___________________________________________________________________
Name: svk:merge
   - 8c4c90e1-83eb-0310-96eb-e7cb62807872:/local/cpan-forum:11089
   + 8c4c90e1-83eb-0310-96eb-e7cb62807872:/local/cpan-forum:11095

Modified: trunk/lib/CPAN/Forum/RM/Notify.pm
===================================================================
--- trunk/lib/CPAN/Forum/RM/Notify.pm	2006-08-30 20:10:03 UTC (rev 213)
+++ trunk/lib/CPAN/Forum/RM/Notify.pm	2006-08-30 22:27:11 UTC (rev 214)
@@ -14,7 +14,7 @@
     my $post = CPAN::Forum::DB::Posts->retrieve($post_id);
 
     my $message = 
-        _text2mail ($post->text) .
+        $self->_text2mail ($post->text) .
         "\n\n" .
         "To write a respons, access\n".
         "http://$ENV{HTTP_HOST}/response_form/" . $post->id .
@@ -94,14 +94,14 @@
 
     my $limit  = $self->config("${type}_size") || 10;
     my $it = $self->get_feed($limit);
-    if ($it) {
+    #if ($it) {
         my $call = "generate_$type";
         return $self->$call($it, $limit);
-    }
-    else {
-        $self->log->warning("Invalid $type feed requested for $ENV{PATH_INFO}");
-        return $self->notes("no_such_${type}_feed");
-    }
+    #}
+    #else {
+    #    $self->log->warning("Invalid $type feed requested for $ENV{PATH_INFO}");
+    #    return $self->notes("no_such_${type}_feed");
+    #}
 }
 
 sub generate_atom {
@@ -121,10 +121,17 @@
     # TODO: replace this e-mail address with a configurable value
     $rss->webmaster('admin at cpanforum.com');
 
-    while (my $post = $it->next() and $limit--) {
-        my $title = sprintf "[%s] %s", $post->gid->name, $post->subject;
-        $rss->item($url. "posts/" . $post->id(), $title); # TODO _subject_escape ?
+    if ($it) {
+        while (my $post = $it->next() and $limit--) {
+            my $title = sprintf "[%s] %s", $post->gid->name, $post->subject;
+            $rss->item($url. "posts/" . $post->id(), $title); # TODO _subject_escape ?
+        }
     }
+    else {
+        # TODO: maybe we should put a link here to search that module ot that
+        # PAUSEID?
+        $rss->item($url, "No posts yet");
+    }
 
     $self->header_props(-type => 'application/rss+xml');
     
@@ -143,6 +150,7 @@
         $self->log->debug("rss of dist: '$dist'");
         my ($group) = CPAN::Forum::DB::Groups->search({ name => $dist });
         if ($group) {
+            $self->log->debug("aha");
             return scalar CPAN::Forum::DB::Posts->search(gid => $group->id, {order_by => 'date DESC'});
         }
     }
@@ -166,5 +174,17 @@
     return;
 }
 
+=head2 _text2mail
+
+replace the markup used in the posting by things we can use in 
+e-mail messages.
+
+=cut
+
+sub _text2mail {
+    return $_[1];
+}
+
+
 1;
 

Modified: trunk/lib/CPAN/Forum.pm
===================================================================
--- trunk/lib/CPAN/Forum.pm	2006-08-30 20:10:03 UTC (rev 213)
+++ trunk/lib/CPAN/Forum.pm	2006-08-30 22:27:11 UTC (rev 214)
@@ -1515,18 +1515,7 @@
 }
 
 
-=head2 _text2mail
 
-replace the markup used in the posting by things we can use in 
-e-mail messages.
-
-=cut
-
-sub _text2mail {
-    return $_[0];
-}
-
-
 sub help {
     $_[0]->load_tmpl("help.tmpl")->output;
 }

Modified: trunk/t/live/live.t
===================================================================
--- trunk/t/live/live.t	2006-08-30 20:10:03 UTC (rev 213)
+++ trunk/t/live/live.t	2006-08-30 22:27:11 UTC (rev 214)
@@ -62,6 +62,9 @@
     $w->get_ok("$url/rss/all");
     $w->content_like(qr{<item>});
 
+    $w->get_ok("$url/rss/threads");
+    $w->content_like(qr{<item>});
+
     #TODO: also test Content type
 
     $w->get_ok("$url/dist/CPAN-Forum");
@@ -79,9 +82,10 @@
     #$w->content_like(qr{<item>});
 
     $w->get_ok("$url/rss/no_such_feed/xyz");
-    $w->content_like(qr{No such RSS feed.});
+    #$w->content_like(qr{No such RSS feed.});
+    $w->content_like(qr{No posts yet});
 
-    BEGIN { $tests += 12; }
+    BEGIN { $tests += 14; }
 }
 
 {



More information about the Cpan-forum-commit mailing list