diff options
author | Max Kanat-Alexander <mkanat@bugzilla.org> | 2010-12-13 12:54:20 -0800 |
---|---|---|
committer | Max Kanat-Alexander <mkanat@bugzilla.org> | 2010-12-13 12:54:20 -0800 |
commit | c93887f249fa25405aad68c56995cdcd2efc1e91 (patch) | |
tree | 600cca1f4b7966bfd947f18e1d880aac44f796a8 /Bugzilla/Comment.pm | |
parent | 9fe88ea66a28168e940bf02038d4055a5e00a4ee (diff) | |
download | bugs-c93887f249fa25405aad68c56995cdcd2efc1e91.tar bugs-c93887f249fa25405aad68c56995cdcd2efc1e91.tar.gz bugs-c93887f249fa25405aad68c56995cdcd2efc1e91.tar.bz2 bugs-c93887f249fa25405aad68c56995cdcd2efc1e91.tar.xz bugs-c93887f249fa25405aad68c56995cdcd2efc1e91.zip |
Bug 617477: Fix numerous consistency and behavior issues surroudning Bug.update
and Bugzilla::Bug. See https://bugzilla.mozilla.org/show_bug.cgi?id=617477#c2
for details.
r=LpSolit, a=LpSolit
Diffstat (limited to 'Bugzilla/Comment.pm')
-rw-r--r-- | Bugzilla/Comment.pm | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/Bugzilla/Comment.pm b/Bugzilla/Comment.pm index 7b9e257df..f3628ddb1 100644 --- a/Bugzilla/Comment.pm +++ b/Bugzilla/Comment.pm @@ -77,7 +77,7 @@ use constant VALIDATORS => { use constant VALIDATOR_DEPENDENCIES => { extra_data => ['type'], bug_id => ['who'], - work_time => ['who'], + work_time => ['who', 'bug_id'], isprivate => ['who'], }; @@ -180,6 +180,17 @@ sub set_extra_data { $_[0]->set('extra_data', $_[1]); } # Validators # ############## +sub run_create_validators { + my $self = shift; + my $params = $self->SUPER::run_create_validators(@_); + # Sometimes this run_create_validators is called with parameters that + # skip bug_id validation, so it might not exist in the resulting hash. + if (defined $params->{bug_id}) { + $params->{bug_id} = $params->{bug_id}->id; + } + return $params; +} + sub _check_extra_data { my ($invocant, $extra_data, undef, $params) = @_; my $type = blessed($invocant) ? $invocant->type : $params->{type}; @@ -246,7 +257,7 @@ sub _check_bug_id { $bug->check_can_change_field('longdesc', 0, 1, \$privs) || ThrowUserError('illegal_change', { field => 'longdesc', privs => $privs }); - return $bug->id; + return $bug; } sub _check_who { @@ -276,7 +287,12 @@ sub _check_work_time { # Call down to Bugzilla::Object, letting it know negative # values are ok - return $invocant->check_time( $value_in, $field, $params, 1); + my $time = $invocant->check_time($value_in, $field, $params, 1); + my $privs; + $params->{bug_id}->check_can_change_field('work_time', 0, $time, \$privs) + || ThrowUserError('illegal_change', + { field => 'work_time', privs => $privs }); + return $time; } sub _check_thetext { |