]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
repobrowse: DRY-up query class and support id2
authorEric Wong <e@80x24.org>
Thu, 24 Dec 2015 01:39:45 +0000 (01:39 +0000)
committerEric Wong <e@80x24.org>
Tue, 5 Apr 2016 18:58:27 +0000 (18:58 +0000)
We'll be adding diff support against arbitrary objects, soon
(which could cause us to be OOM-ed easily if we're not careful
 with big objects).

lib/PublicInbox/RepoBrowseQuery.pm

index 979a2b683d32d0dcdb668db6191775f555f9ae3f..861e587b636d6e22e8570acd3f6068fd8e51a40a 100644 (file)
@@ -1,16 +1,18 @@
 # Copyright (C) 2015 all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 
+# query parameter management for repobrowse
 package PublicInbox::RepoBrowseQuery;
 use strict;
 use warnings;
 use PublicInbox::Hval;
+my @KNOWN_PARAMS = qw(id id2 h showmsg ofs);
 
 sub new {
        my ($class, $cgi) = @_;
        my $self = bless {}, $class;
 
-       foreach my $k (qw(id h showmsg ofs)) {
+       foreach my $k (@KNOWN_PARAMS) {
                my $v = $cgi->param($k);
                $self->{$k} = defined $v ? $v : '';
        }
@@ -27,7 +29,7 @@ sub qs {
        }
 
        my @qs;
-       foreach my $k (qw(id h showmsg ofs)) {
+       foreach my $k (@KNOWN_PARAMS) {
                my $v = $self->{$k};
 
                next if ($v eq '');