summaryrefslogtreecommitdiffstats
path: root/buglist.cgi
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2007-07-21 18:46:36 +0200
committerlpsolit%gmail.com <>2007-07-21 18:46:36 +0200
commit9cd591485eb17d68ed5637b87d17cdad5536116a (patch)
treebce567feea5e142ea1c2a15432dc9e462dec43f8 /buglist.cgi
parent28550c3d3e02420c40932321100785ad8f940897 (diff)
downloadbugzilla-9cd591485eb17d68ed5637b87d17cdad5536116a.tar.gz
bugzilla-9cd591485eb17d68ed5637b87d17cdad5536116a.tar.xz
Bug 385003: Entering a tag name manually ("create and add the tag") should not silently remove the tag from any other bugs (overwrites) - Patch by Frédéric Buclin <LpSolit@gmail.com> r=wurblzap a=LpSolit
Diffstat (limited to 'buglist.cgi')
-rwxr-xr-xbuglist.cgi15
1 files changed, 10 insertions, 5 deletions
diff --git a/buglist.cgi b/buglist.cgi
index aa19a4b4b..f9c9875c4 100755
--- a/buglist.cgi
+++ b/buglist.cgi
@@ -513,17 +513,22 @@ elsif (($cgi->param('cmdtype') eq "doit") && defined $cgi->param('remtype')) {
}
my %bug_ids;
+ my $is_new_name = 0;
if ($query_name) {
# Make sure this name is not already in use by a normal saved search.
if (LookupNamedQuery($query_name, undef, QUERY_LIST, !THROW_ERROR)) {
ThrowUserError('query_name_exists', {'name' => $query_name});
}
+ $is_new_name = 1;
}
- else {
- # No new query name has been given. We retrieve bug IDs
- # currently set in the selected saved search.
- $query_name = $cgi->param('oldqueryname');
- my $old_query = LookupNamedQuery($query_name, undef, LIST_OF_BUGS);
+ # If no new tag name has been given, use the selected one.
+ $query_name ||= $cgi->param('oldqueryname');
+
+ # Don't throw an error if it's a new tag name: if the tag already
+ # exists, add/remove bugs to it, else create it. But if we are
+ # considering an existing tag, then it has to exist and we throw
+ # an error if it doesn't (hence the usage of !$is_new_name).
+ if (my $old_query = LookupNamedQuery($query_name, undef, LIST_OF_BUGS, !$is_new_name)) {
# We get the encoded query. We need to decode it.
my $old_cgi = new Bugzilla::CGI($old_query);
foreach my $bug_id (split /[\s,]+/, scalar $old_cgi->param('bug_id')) {