]> Sergey Matveev's repositories - public-inbox.git/commitdiff
cgi: wire up index + tests
authorEric Wong <e@80x24.org>
Thu, 10 Apr 2014 00:33:54 +0000 (00:33 +0000)
committerEric Wong <e@80x24.org>
Thu, 10 Apr 2014 00:33:54 +0000 (00:33 +0000)
Remove the specified /all.html while we're at it, we only have
/all.atom.xml because it's convenient for feed readers.

Documentation/design_www.txt
public-inbox-cgi
t/cgi.t

index d0677d50c82cb1bff7990ef06a1d2473d63c4b64..c8c4f304becc74659e133e25e8029adb7aba36bd 100644 (file)
@@ -2,7 +2,6 @@ URL naming
 ----------
 
 /$LISTNAME/?before=$GIT_COMMIT                  -> HTML only
-/$LISTNAME/all.html?before=$GIT_COMMIT          -> HTML only, includes replies
 /$LISTNAME/index.atom.xml                       -> Atom feed
 /$LISTNAME/all.atom.xml                         -> Atom feed, includes replies
 /$LISTNAME/m/$MESSAGE_ID.html                   -> HTML content (short quotes)
index 4e727da8a61fd20df7fd3921388314e15234be86..912bb191bd3e1f75ad9f6e0be2c8e07de93618cb 100755 (executable)
@@ -56,9 +56,7 @@ sub main {
        if ($path_info eq "/") {
                r404();
        } elsif ($path_info =~ m!$LISTNAME_RE/?\z!o) {
-               invalid_list(\%ctx, $1) || get_list_log(\%ctx, $cgi);
-       } elsif ($path_info =~ m!$LISTNAME_RE/all\z!o) {
-               invalid_list(\%ctx, $1) || get_list_all(\%ctx, $cgi);
+               invalid_list(\%ctx, $1) || get_index(\%ctx, $cgi, 1);
        } elsif ($path_info =~ m!$LISTNAME_RE/index\.atom\.xml\z!o) {
                invalid_list(\%ctx, $1) || get_atom(\%ctx, $cgi, 1);
        } elsif ($path_info =~ m!$LISTNAME_RE/all\.atom\.xml\z!o) {
@@ -114,3 +112,17 @@ sub get_atom {
                })
        ];
 }
+
+sub get_index {
+       my ($ctx, $cgi, $top) = @_;
+       require PublicInbox::Feed;
+       [ '200 OK', { 'Content-Type' => 'text/html' },
+         PublicInbox::Feed->generate_html_index({
+                       git_dir => $ctx->{git_dir},
+                       listname => $ctx->{listname},
+                       pi_config => $pi_config,
+                       cgi => $cgi,
+                       top => $top,
+               })
+       ];
+}
diff --git a/t/cgi.t b/t/cgi.t
index f359cf6e1f1ffc1bddfbeef70d2098620fef6655..3ba74f30cb10d03663a943f6690990191606ce8f 100644 (file)
--- a/t/cgi.t
+++ b/t/cgi.t
@@ -117,16 +117,9 @@ EOF
 # indices
 {
        local $ENV{HOME} = $home;
-       my $res = cgi_run("/test/all.atom.xml");
-       like($res->{body}, qr/<title>test for public-inbox/,
-               "set title in XML feed");
-       like($res->{body},
-               qr!http://test\.example\.com/test/mid/blah%40example\.com!,
-               "link id set");
-       like($res->{body}, qr/what\?/, "reply included");
-
-       $res = cgi_run("/test/index.atom.xml");
-       unlike($res->{body}, qr/what\?/, "reply not included in index");
+       my $res = cgi_run("/test/");
+       like($res->{head}, qr/Status: 200 OK/, "index returns 200");
+       # more checks in t/feed.t
 }
 
 done_testing();