=cut
sub process {
- my ($target, $timestamp, $cgi) = @_;
+ my ($bug_id, $attach_id, $timestamp, $cgi) = @_;
my $dbh = Bugzilla->dbh;
- my $bug_id = $target->{'bug'}->{'id'};
- my $attach_id = $target->{'attachment'}->{'id'};
+ my $target = get_target($bug_id, $attach_id);
+ # Make sure the target exists.
+ return unless $target->{'exists'};
# Use the date/time we were given if possible (allowing calling code
# to synchronize the comment's timestamp with those of other records).
my @type_ids = map(/^flag_type-(\d+)$/ ? $1 : (), $cgi->param());
@type_ids = grep($cgi->param("flag_type-$_") ne 'X', @type_ids);
- return () unless (scalar(@type_ids) && $target->{'exists'});
+ return () unless scalar(@type_ids);
# Get information about the setter to add to each flag.
my $setter = new Bugzilla::User($::userid);
=over
-=item C<GetTarget($bug_id, $attach_id)>
+=item C<get_target($bug_id, $attach_id)>
Someone please document this function.
=cut
-sub GetTarget {
+sub get_target {
my ($bug_id, $attach_id) = @_;
# Create an object representing the target bug/attachment.
exists => $exists ,
id => $id ,
type => Bugzilla::FlagType::get($type_id) ,
- target => GetTarget($bug_id, $attach_id) ,
+ target => get_target($bug_id, $attach_id) ,
requestee => $requestee_id ? new Bugzilla::User($requestee_id) : undef,
setter => new Bugzilla::User($setter_id) ,
status => $status ,
}
# Create flags.
- my $target = Bugzilla::Flag::GetTarget(undef, $attachid);
- Bugzilla::Flag::process($target, $timestamp, $cgi);
+ Bugzilla::Flag::process($bugid, $attachid, $timestamp, $cgi);
# Define the variables and functions that will be passed to the UI template.
$vars->{'mailrecipients'} = { 'changer' => Bugzilla->user->login,
# to attachments so that we can delete pending requests if the user
# is obsoleting this attachment without deleting any requests
# the user submits at the same time.
- my $target = Bugzilla::Flag::GetTarget(undef, $attach_id);
- Bugzilla::Flag::process($target, $timestamp, $cgi);
+ Bugzilla::Flag::process($bugid, $attach_id, $timestamp, $cgi);
# Update the attachment record in the database.
SendSQL("UPDATE attachments
}
}
# Set and update flags.
- my $target = Bugzilla::Flag::GetTarget($id);
- Bugzilla::Flag::process($target, $timestamp, $cgi);
+ Bugzilla::Flag::process($id, undef, $timestamp, $cgi);
if ($bug_changed) {
SendSQL("UPDATE bugs SET delta_ts = $sql_timestamp WHERE bug_id = $id");