From 19630bdbdff44d9286ca489c39d3eaf52f391f5c Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Sat, 11 Jun 2005 02:19:21 +0000 Subject: [PATCH] =?utf8?q?Bug=20277417:=20SQL=20error=20when=20reloading?= =?utf8?q?=20the=20page=20after=20changing=20the=20bug=20resolution=20to?= =?utf8?q?=20duplicate=20-=20Patch=20by=20Fr=C3=A9d=C3=A9ric=20Buclin=20=20r=3Dwicked=20a=3Djustdave?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- process_bug.cgi | 10 ++++++++++ template/en/default/global/user-error.html.tmpl | 5 +++++ 2 files changed, 15 insertions(+) diff --git a/process_bug.cgi b/process_bug.cgi index 7b0dd6a8a6..34444dfcfc 100755 --- a/process_bug.cgi +++ b/process_bug.cgi @@ -1038,6 +1038,16 @@ SWITCH: for ($cgi->param('knob')) { ThrowUserError("dupe_of_self_disallowed"); } + # Make sure the bug is not already marked as a dupe + # (may appear in race condition) + my $dupe_of = + $dbh->selectrow_array("SELECT dupe_of FROM duplicates + WHERE dupe = ?", + undef, $cgi->param('id')); + if ($dupe_of) { + ThrowUserError("dupe_entry_found", { dupe_of => $dupe_of }); + } + # DUPLICATE bugs should have no time remaining. _remove_remaining_time(); diff --git a/template/en/default/global/user-error.html.tmpl b/template/en/default/global/user-error.html.tmpl index 3d7599711a..d01af23750 100644 --- a/template/en/default/global/user-error.html.tmpl +++ b/template/en/default/global/user-error.html.tmpl @@ -326,6 +326,11 @@ [% title = "Description Required" %] You must provide a description of the [% terms.bug %]. + [% ELSIF error == "dupe_entry_found" %] + [% title = "Already marked as duplicate" %] + This [% terms.bug %] has already been marked as a duplicate + of [% terms.bug %] [%+ dupe_of FILTER html %]. + [% ELSIF error == "dupe_of_self_disallowed" %] [% title = "Cannot mark $terms.abug as a duplicate of itself" %] You can't mark [% terms.abug %] as a duplicate of itself. -- 2.47.3