summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Haas2009-07-04 00:05:17 +0000
committerRobert Haas2009-07-04 00:05:17 +0000
commit62159b9e086d901b37e9b7ca1d2b58264e4f574e (patch)
tree8c59cb2f66025019126b2f871d6c5216a619008e
parent2aec1f66cb27bd3452592003a68e614fab220df1 (diff)
Stable links for open, in-progress, and previous CommitFests.
-rw-r--r--perl-lib/PgCommitFest/CommitFest.pm34
-rw-r--r--perl-lib/PgCommitFest/DB.pm5
-rw-r--r--template/commitfest_search.tt217
3 files changed, 48 insertions, 8 deletions
diff --git a/perl-lib/PgCommitFest/CommitFest.pm b/perl-lib/PgCommitFest/CommitFest.pm
index de19005..a4115b2 100644
--- a/perl-lib/PgCommitFest/CommitFest.pm
+++ b/perl-lib/PgCommitFest/CommitFest.pm
@@ -86,11 +86,39 @@ EOM
}
sub view {
- my ($r) = @_;
+ my ($r, $extrapath) = @_;
my $aa = $r->authenticate();
+
+ # Target commitfest can be specified either by ID, or we allow special
+ # magic to fetch it by
my $id = $r->cgi_id();
- my $d = $r->db->select_one(<<EOM, $id) if defined $id;
-SELECT id, name, commitfest_status FROM commitfest_view WHERE id = ?
+ my $sqlbit;
+ if (defined $id) {
+ $sqlbit = "WHERE id = " . $r->db->quote($id);
+ }
+ elsif (defined $extrapath) {
+ if ($extrapath eq 'open') {
+ $sqlbit =
+ "WHERE commitfest_status_id = 2 ORDER BY name DESC LIMIT 1";
+ }
+ elsif ($extrapath eq 'inprogress') {
+ $sqlbit = <<EOM;
+WHERE commitfest_status_id IN (2, 3)
+ ORDER BY commitfest_status_id DESC, name DESC LIMIT 1
+EOM
+ }
+ elsif ($extrapath eq 'previous') {
+ $sqlbit =
+ "WHERE commitfest_status_id = 4 ORDER BY name DESC LIMIT 1";
+ }
+ }
+ if (!defined $sqlbit) {
+ $r->error_exit("Unable to identify target CommitFest.");
+ }
+
+ # Fetch target commitfest from database.
+ my $d = $r->db->select_one(<<EOM);
+SELECT id, name, commitfest_status FROM commitfest_view $sqlbit
EOM
$r->error_exit('CommitFest not found.') if !defined $d;
$r->set_title('CommitFest %s (%s)', $d->{'name'},
diff --git a/perl-lib/PgCommitFest/DB.pm b/perl-lib/PgCommitFest/DB.pm
index 0cd3b7d..4719007 100644
--- a/perl-lib/PgCommitFest/DB.pm
+++ b/perl-lib/PgCommitFest/DB.pm
@@ -89,6 +89,11 @@ sub insert_returning_id {
return $result->{'id'};
}
+sub quote {
+ my ($self, $value) = @_;
+ return $self->{'dbh'}->quote($value);
+}
+
sub rollback {
my ($self) = @_;
$self->{'dirty'} = 0;
diff --git a/template/commitfest_search.tt2 b/template/commitfest_search.tt2
index ab34187..9a14dd6 100644
--- a/template/commitfest_search.tt2
+++ b/template/commitfest_search.tt2
@@ -1,9 +1,16 @@
-<p>If you want to submit a new patch for review, please visit the <b>Open</b>
-CommitFest. If you want to help with the reviewing process for the
+<p>If you have submitted a patch to pgsql-hackers and want it to be reviewed,
+you should add it to the <a href='/https/git.postgresql.org/action/commitfest_view/open'>Open
+CommitFest</a>. If you want to help with the reviewing process for the
CommitFest that's currently taking place (if any), please visit the
-CommitFest <b>In Progress</b>. Previous CommitFests are marked as
-<b>Closed</b>, and scheduled upcoming CommitFests (other than the one to which
-patches should be submitted) are marked as <b>Future</b>.</p>
+<a href='/https/git.postgresql.org/action/commitfest_view/inprogress'>CommitFest In Progress</a>.
+These links are stable and always reference the open or in progress
+CommitFest, respectively, provided such a CommitFest exists. (If there is no
+CommitFest in progress, the CommitFest In Progress link will reference the
+Open CommitFest instead.) There is also a stable link for the
+<a href='/https/git.postgresql.org/action/commitfest_view/previous'>Previous CommitFest</a>, meaning
+the most recent one that is now marked Closed. Upcoming CommitFests
+(other than the one to which patches should be submitted) are marked
+as <b>Future</b>.</p>
[% IF list.size == 0 %]
<p><b>No CommitFests have been defined yet.</b></p>