summaryrefslogtreecommitdiffstats
path: root/buglist.cgi
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2005-09-26 06:04:30 +0200
committerlpsolit%gmail.com <>2005-09-26 06:04:30 +0200
commit36331f2e6bd025fbb4c131b71223f94dbe5de724 (patch)
treeac98e98615e9da748b742c95fc05c783b34fc801 /buglist.cgi
parent67cb0c3f70d5b3d98e30a9e3ce7ac3b00766f9d9 (diff)
downloadbugzilla-36331f2e6bd025fbb4c131b71223f94dbe5de724.tar.gz
bugzilla-36331f2e6bd025fbb4c131b71223f94dbe5de724.tar.xz
Bug 308228: Whine-related saved search can be forgotten through buglist.cgi - Patch by A. Karl Kornel <karl@kornel.name> r=LpSolit a=justdave
Diffstat (limited to 'buglist.cgi')
-rwxr-xr-xbuglist.cgi21
1 files changed, 21 insertions, 0 deletions
diff --git a/buglist.cgi b/buglist.cgi
index 1e4ab0cb5..f8f81d3e5 100755
--- a/buglist.cgi
+++ b/buglist.cgi
@@ -388,6 +388,27 @@ if ($cgi->param('cmdtype') eq "dorem") {
# the SQL, and the SQL is only a DELETE.
my $qname = $cgi->param('namedcmd');
trick_taint($qname);
+
+ # Do not forget the saved search if it is being used in a whine
+ my $whines_in_use =
+ $dbh->selectcol_arrayref('SELECT DISTINCT whine_events.subject
+ FROM whine_events
+ INNER JOIN whine_queries
+ ON whine_queries.eventid
+ = whine_events.id
+ WHERE whine_events.owner_userid
+ = ?
+ AND whine_queries.query_name
+ = ?
+ ', undef, Bugzilla->user->id, $qname);
+ if (scalar(@$whines_in_use)) {
+ ThrowUserError('saved_search_used_by_whines',
+ { subjects => join(',', @$whines_in_use),
+ search_name => $qname }
+ );
+ }
+
+ # If we are here, then we can safely remove the saved search
$dbh->do("DELETE FROM namedqueries"
. " WHERE userid = ? AND name = ?"
, undef, ($userid, $qname));