From 7c4236d2aad932ed8217c321620c3308615e7a8f Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Mon, 19 May 2014 14:17:55 +0400 Subject: [PATCH] Fix removecc --- Bugzilla/Bug.pm | 7 ++++--- process_bug.cgi | 6 +++--- template/en/default/global/user-error.html.tmpl | 8 +++++--- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm index 0f2b3b6e8..56d2b98c1 100644 --- a/Bugzilla/Bug.pm +++ b/Bugzilla/Bug.pm @@ -796,7 +796,7 @@ sub _check_bug_status @valid_statuses = grep { $_->is_confirmed } @valid_statuses; } - if ($self->{assigned_to} && $user->id != $self->{assigned_to}) + if ($self->assigned_to_id && $user->id != $self->assigned_to_id) { # You can not assign bugs to other people @valid_statuses = grep { !$_->is_assigned } @valid_statuses; @@ -1007,6 +1007,7 @@ sub save_cc push @{$self->{restricted_cc}}, $_; } } + $self->{restricted_cc} = undef if !@{$self->{restricted_cc}}; } my $removed_cc = [ grep { !$new_cc{$_} } keys %old_cc ]; @@ -2358,7 +2359,7 @@ sub remove_cc my ($self, $user_or_name) = @_; my $user = ref $user_or_name ? $user_or_name : Bugzilla::User->check($user_or_name); my $cc_users = $self->cc_users; - if (grep { $_->id != $user->id } @$cc_users) + if (grep { $_->id == $user->id } @$cc_users) { $self->make_dirty; @$cc_users = grep { $_->id != $user->id } @$cc_users; @@ -2733,7 +2734,7 @@ sub cc_users { my $self = shift; return $self->{cc_users} if exists $self->{cc_users}; - return [] if !$self->id; + return $self->{cc_users} = [] if !$self->id; my $dbh = Bugzilla->dbh; my $cc_ids = $dbh->selectcol_arrayref('SELECT who FROM cc WHERE bug_id = ?', undef, $self->id); diff --git a/process_bug.cgi b/process_bug.cgi index 22b8e774b..704edbba8 100755 --- a/process_bug.cgi +++ b/process_bug.cgi @@ -494,9 +494,9 @@ if ($ARGS->{newcc} || $ARGS->{addselfcc} || $ARGS->{removecc} || $ARGS->{masscc} $cc_add = $ARGS->{newcc}; # We came from bug_form which uses a select box to determine what cc's # need to be removed... - if (defined $ARGS->{removecc} && $ARGS->{cc}) # FIXME array[] + if (defined $ARGS->{removecc} && $ARGS->{cc}) { - $cc_remove = join ",", @{$ARGS->{cc}}; + $cc_remove = $ARGS->{cc}; } } @@ -674,7 +674,7 @@ foreach my $bug (@bug_objects) # CustIS Bug 38616 - CC list restriction if ($bug->{restricted_cc}) { - $vars->{restricted_cc} = [map { $_->login } @{$bug->{restricted_cc}}]; + $vars->{restricted_cc} = [ map { $_->login } @{$bug->{restricted_cc}} ]; $vars->{cc_restrict_group} = $bug->product_obj->cc_group; $vars->{message} = 'cc_list_restricted'; } diff --git a/template/en/default/global/user-error.html.tmpl b/template/en/default/global/user-error.html.tmpl index 743a782e3..4fc6c9b74 100644 --- a/template/en/default/global/user-error.html.tmpl +++ b/template/en/default/global/user-error.html.tmpl @@ -903,11 +903,13 @@ [% BLOCK error_illegal_bug_status_transition %] [% title = "Illegal $terms.Bug Status Change" %] - [% IF old.defined %] + [% IF old.defined && old.id != new.id %] You are not allowed to change the [% terms.bug %] status from [%+ old.name FILTER html %] to [% new.name FILTER html %]. - [% ELSIF new.name == "ASSIGNED" %] - You are not allowed to assign new [% terms.bugs %] to other people. + [% ELSIF new.is_assigned %] + You are not allowed to assign [% terms.bugs %] to other people. + [% ELSIF !new.is_confirmed %] + Unconfirmed states are disabled in this product. [% ELSE %] You are not allowed to file new [% terms.bugs %] with the [%+ new.name FILTER html %] status.