Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
7d308032
Commit
7d308032
authored
May 22, 2010
by
Max Kanat-Alexander
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 556403: Move adding/removing of CCs from process_bug.cgi into
Bugzilla::Bug::set_all
parent
5f2a455c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
48 deletions
+49
-48
Bug.pm
Bugzilla/Bug.pm
+17
-12
process_bug.cgi
process_bug.cgi
+32
-36
No files found.
Bugzilla/Bug.pm
View file @
7d308032
...
...
@@ -1892,12 +1892,7 @@ sub set_all {
# strict_isolation checks mean that we should set the groups
# immediately after changing the product.
foreach
my
$group
(
@
{
$params
->
{
groups
}
->
{
add
}
||
[]
})
{
$self
->
add_group
(
$group
);
}
foreach
my
$group
(
@
{
$params
->
{
groups
}
->
{
remove
}
||
[]
})
{
$self
->
remove_group
(
$group
);
}
$self
->
_add_remove
(
$params
,
'groups'
);
if
(
exists
$params
->
{
'dependson'
}
or
exists
$params
->
{
'blocked'
})
{
my
%
set_deps
;
...
...
@@ -1953,12 +1948,7 @@ sub set_all {
$self
->
reset_assigned_to
if
$params
->
{
'reset_assigned_to'
};
$self
->
reset_qa_contact
if
$params
->
{
'reset_qa_contact'
};
foreach
my
$url
(
@
{
$params
->
{
see_also
}
->
{
add
}
||
[]
})
{
$self
->
add_see_also
(
$url
);
}
foreach
my
$url
(
@
{
$params
->
{
see_also
}
->
{
remove
}
||
[]
})
{
$self
->
remove_see_also
(
$url
);
}
$self
->
_add_remove
(
$params
,
'see_also'
);
# And set custom fields.
my
@custom_fields
=
Bugzilla
->
active_custom_fields
;
...
...
@@ -1968,6 +1958,21 @@ sub set_all {
$self
->
set_custom_field
(
$field
,
$params
->
{
$fname
});
}
}
$self
->
_add_remove
(
$params
,
'cc'
);
}
# Helper for set_all that helps with fields that have an "add/remove"
# pattern instead of a "set_" pattern.
sub
_add_remove
{
my
(
$self
,
$params
,
$name
)
=
@_
;
my
@add
=
@
{
$params
->
{
$name
}
->
{
add
}
||
[]
};
my
@remove
=
@
{
$params
->
{
$name
}
->
{
remove
}
||
[]
};
$name
=~
s/s$//
;
my
$add_method
=
"add_$name"
;
my
$remove_method
=
"remove_$name"
;
$self
->
$add_method
(
$_
)
foreach
@add
;
$self
->
$remove_method
(
$_
)
foreach
@remove
;
}
sub
set_alias
{
$_
[
0
]
->
set
(
'alias'
,
$_
[
1
]);
}
...
...
process_bug.cgi
View file @
7d308032
...
...
@@ -309,6 +309,38 @@ foreach my $dep_field (qw(dependson blocked)) {
}
}
}
# Formulate the CC data into two arrays of users involved in this CC change.
my
(
@cc_add
,
@cc_remove
);
if
(
defined
$cgi
->
param
(
'newcc'
)
or
defined
$cgi
->
param
(
'addselfcc'
)
or
defined
$cgi
->
param
(
'removecc'
)
or
defined
$cgi
->
param
(
'masscc'
))
{
# If masscc is defined, then we came from buglist and need to either add or
# remove cc's... otherwise, we came from show_bug and may need to do both.
my
(
$cc_add
,
$cc_remove
)
=
""
;
if
(
defined
$cgi
->
param
(
'masscc'
))
{
if
(
$cgi
->
param
(
'ccaction'
)
eq
'add'
)
{
$cc_add
=
$cgi
->
param
(
'masscc'
);
}
elsif
(
$cgi
->
param
(
'ccaction'
)
eq
'remove'
)
{
$cc_remove
=
$cgi
->
param
(
'masscc'
);
}
}
else
{
$cc_add
=
$cgi
->
param
(
'newcc'
);
# We came from bug_form which uses a select box to determine what cc's
# need to be removed...
if
(
$cgi
->
param
(
'removecc'
)
&&
$cgi
->
param
(
'cc'
))
{
$cc_remove
=
join
(
","
,
$cgi
->
param
(
'cc'
));
}
}
push
(
@cc_add
,
split
(
/[\s,]+/
,
$cc_add
))
if
$cc_add
;
push
(
@cc_add
,
Bugzilla
->
user
)
if
$cgi
->
param
(
'addselfcc'
);
push
(
@cc_remove
,
split
(
/[\s,]+/
,
$cc_remove
))
if
$cc_remove
;
}
$set_all_fields
{
cc
}
=
{
add
=>
\
@cc_add
,
remove
=>
\
@cc_remove
};
# Fields that can only be set on one bug at a time.
if
(
defined
$cgi
->
param
(
'id'
))
{
...
...
@@ -370,43 +402,7 @@ if (defined $cgi->param('id')) {
$first_bug
->
set_flags
(
$flags
,
$new_flags
);
}
# We need to check the addresses involved in a CC change before we touch
# any bugs. What we'll do here is formulate the CC data into two arrays of
# users involved in this CC change. Then those arrays can be used later
# on for the actual change.
my
(
@cc_add
,
@cc_remove
);
if
(
defined
$cgi
->
param
(
'newcc'
)
||
defined
$cgi
->
param
(
'addselfcc'
)
||
defined
$cgi
->
param
(
'removecc'
)
||
defined
$cgi
->
param
(
'masscc'
))
{
# If masscc is defined, then we came from buglist and need to either add or
# remove cc's... otherwise, we came from bugform and may need to do both.
my
(
$cc_add
,
$cc_remove
)
=
""
;
if
(
defined
$cgi
->
param
(
'masscc'
))
{
if
(
$cgi
->
param
(
'ccaction'
)
eq
'add'
)
{
$cc_add
=
join
(
' '
,
$cgi
->
param
(
'masscc'
));
}
elsif
(
$cgi
->
param
(
'ccaction'
)
eq
'remove'
)
{
$cc_remove
=
join
(
' '
,
$cgi
->
param
(
'masscc'
));
}
}
else
{
$cc_add
=
join
(
' '
,
$cgi
->
param
(
'newcc'
));
# We came from bug_form which uses a select box to determine what cc's
# need to be removed...
if
(
defined
$cgi
->
param
(
'removecc'
)
&&
$cgi
->
param
(
'cc'
))
{
$cc_remove
=
join
(
","
,
$cgi
->
param
(
'cc'
));
}
}
push
(
@cc_add
,
split
(
/[\s,]+/
,
$cc_add
))
if
$cc_add
;
push
(
@cc_add
,
Bugzilla
->
user
)
if
$cgi
->
param
(
'addselfcc'
);
push
(
@cc_remove
,
split
(
/[\s,]+/
,
$cc_remove
))
if
$cc_remove
;
}
foreach
my
$b
(
@bug_objects
)
{
$b
->
remove_cc
(
$_
)
foreach
@cc_remove
;
$b
->
add_cc
(
$_
)
foreach
@cc_add
;
# Theoretically you could move a product without ever specifying
# a new assignee or qa_contact, or adding/removing any CCs. So,
# we have to check that the current assignee, qa, and CCs are still
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment