summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Comment.pm
diff options
context:
space:
mode:
authorMax Kanat-Alexander <mkanat@bugzilla.org>2010-04-22 20:08:39 +0200
committerMax Kanat-Alexander <mkanat@bugzilla.org>2010-04-22 20:08:39 +0200
commit7ce9b17e54a32c62d92f0c5bf2101f5451a1560c (patch)
tree83b01b4c795c7c65e5284278c4ea054b3353be8c /Bugzilla/Comment.pm
parent1ca0fef039a59342427d9e853a2d89ab6300c147 (diff)
downloadbugzilla-7ce9b17e54a32c62d92f0c5bf2101f5451a1560c.tar.gz
bugzilla-7ce9b17e54a32c62d92f0c5bf2101f5451a1560c.tar.xz
Bug 539865: Make Bugzilla::Object pass $params to validators during create()
(implement VALIDATOR_DEPENDENCIES) r=LpSolit, a=LpSolit
Diffstat (limited to 'Bugzilla/Comment.pm')
-rw-r--r--Bugzilla/Comment.pm15
1 files changed, 9 insertions, 6 deletions
diff --git a/Bugzilla/Comment.pm b/Bugzilla/Comment.pm
index ba33ba5f3..be10329d9 100644
--- a/Bugzilla/Comment.pm
+++ b/Bugzilla/Comment.pm
@@ -30,6 +30,8 @@ use Bugzilla::Error;
use Bugzilla::User;
use Bugzilla::Util;
+use Scalar::Util qw(blessed);
+
###############################
#### Initialization ####
###############################
@@ -57,11 +59,12 @@ use constant ID_FIELD => 'comment_id';
use constant LIST_ORDER => 'bug_when';
use constant VALIDATORS => {
+ extra_data => \&_check_extra_data,
type => \&_check_type,
};
-use constant UPDATE_VALIDATORS => {
- extra_data => \&_check_extra_data,
+use constant VALIDATOR_DEPENDENCIES => {
+ extra_data => ['type'],
};
#########################
@@ -154,9 +157,8 @@ sub body_full {
sub set_extra_data { $_[0]->set('extra_data', $_[1]); }
sub set_type {
- my ($self, $type, $extra_data) = @_;
+ my ($self, $type) = @_;
$self->set('type', $type);
- $self->set_extra_data($extra_data);
}
##############
@@ -164,8 +166,9 @@ sub set_type {
##############
sub _check_extra_data {
- my ($invocant, $extra_data, $type) = @_;
- $type = $invocant->type if ref $invocant;
+ my ($invocant, $extra_data, undef, $params) = @_;
+ my $type = blessed($invocant) ? $invocant->type : $params->{type};
+
if ($type == CMT_NORMAL) {
if (defined $extra_data) {
ThrowCodeError('comment_extra_data_not_allowed',