summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authorMax Kanat-Alexander <mkanat@bugzilla.org>2010-06-25 23:16:27 +0200
committerMax Kanat-Alexander <mkanat@bugzilla.org>2010-06-25 23:16:27 +0200
commit0d39e7b417190ad672219768eab41d627cc68bb9 (patch)
tree6cf83f87c52613161665338d942cc08904b0cb8c /Bugzilla
parented5c3b391a381d363e1b9070554d11c2b4881e3f (diff)
downloadbugzilla-0d39e7b417190ad672219768eab41d627cc68bb9.tar.gz
bugzilla-0d39e7b417190ad672219768eab41d627cc68bb9.tar.xz
Bug 573173: Make Bugzilla::Bug's add_group and remove_group take group
names instead of ids r=dkl, a=mkanat
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/Bug.pm14
1 files changed, 6 insertions, 8 deletions
diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm
index 58901c57e..ea8e4bc3d 100644
--- a/Bugzilla/Bug.pm
+++ b/Bugzilla/Bug.pm
@@ -2682,8 +2682,7 @@ sub add_group {
my ($self, $group) = @_;
# Invalid ids are silently ignored. (We can't tell people whether
# or not a group exists.)
- $group = new Bugzilla::Group($group) unless ref $group;
- return unless $group;
+ $group = Bugzilla::Group->check($group) if !blessed $group;
return if !$group->is_active or !$group->is_bug_group;
@@ -2691,7 +2690,7 @@ sub add_group {
# to this group by the current user.
$self->product_obj->group_is_settable($group)
|| ThrowUserError('group_invalid_restriction',
- { product => $self->product, group_id => $group->id,
+ { product => $self->product, group => $group,
bug => $self });
# OtherControl people can add groups only during a product change,
@@ -2702,7 +2701,7 @@ sub add_group {
|| $controls->{othercontrol} == CONTROLMAPNA)
{
ThrowUserError('group_change_denied',
- { bug => $self, group_id => $group->id });
+ { bug => $self, group => $group });
}
}
@@ -2714,8 +2713,7 @@ sub add_group {
sub remove_group {
my ($self, $group) = @_;
- $group = new Bugzilla::Group($group) unless ref $group;
- return unless $group;
+ $group = Bugzilla::Group->check($group) if !blessed $group;
# First, check if this is a valid group for this product.
# You can *always* remove a group that is not valid for this product
@@ -2731,7 +2729,7 @@ sub remove_group {
# Nobody can ever remove a Mandatory group.
if ($controls->{membercontrol} == CONTROLMAPMANDATORY) {
ThrowUserError('group_invalid_removal',
- { product => $self->product, group_id => $group->id,
+ { product => $self->product, group => $group,
bug => $self });
}
@@ -2743,7 +2741,7 @@ sub remove_group {
|| $controls->{othercontrol} == CONTROLMAPNA)
{
ThrowUserError('group_change_denied',
- { bug => $self, group_id => $group->id });
+ { bug => $self, group => $group });
}
}
}