Rename Bugzilla::User::match to match_name to not hide Bugzilla::Object method
parent
fd436a37fc
commit
21237a5070
|
@ -422,9 +422,7 @@ sub match
|
|||
my $names = $params->{$field};
|
||||
my $type = $translate_fields{$field};
|
||||
my $param = $type eq 'Bugzilla::User' ? 'login_name' : 'name';
|
||||
# We call Bugzilla::Object::match directly to avoid the
|
||||
# Bugzilla::User::match implementation which is different.
|
||||
my $objects = Bugzilla::Object::match($type, { $param => $names });
|
||||
my $objects = $type->match({ $param => $names });
|
||||
push(@ids, map { $_->id } @$objects);
|
||||
}
|
||||
# You can also specify ids directly as arguments to this function,
|
||||
|
@ -1891,7 +1889,7 @@ sub _set_cc
|
|||
|
||||
# Allow comma-separated input as well as arrayrefs.
|
||||
$ccs = [ grep { $_ } split /[\s,]+/, trim($ccs) ] if !ref $ccs;
|
||||
my $users = Bugzilla::Object::match('Bugzilla::User', { login_name => $ccs });
|
||||
my $users = Bugzilla::User->match({ login_name => $ccs });
|
||||
$ccs = { map { lc($_) => 1 } @$ccs };
|
||||
for (@$users)
|
||||
{
|
||||
|
|
|
@ -1011,29 +1011,25 @@ sub notify {
|
|||
# Is there someone to notify?
|
||||
return unless ($addressee || $cc_list);
|
||||
|
||||
# FIXME УБРАТЬ
|
||||
# If the target bug is restricted to one or more groups, then we need
|
||||
# to make sure we don't send email about it to unauthorized users
|
||||
# on the request type's CC: list, so we have to trawl the list for users
|
||||
# not in those groups or email addresses that don't have an account.
|
||||
my @bug_in_groups = grep {$_->{'ison'} || $_->{'mandatory'}} @{$bug->groups};
|
||||
my $attachment_is_private = $attachment ? $attachment->isprivate : undef;
|
||||
my $attachment_is_private = $attachment && $attachment->isprivate;
|
||||
|
||||
my %recipients;
|
||||
foreach my $cc (split(/[, ]+/, $cc_list)) {
|
||||
my $ccuser = new Bugzilla::User({ name => $cc });
|
||||
next if (scalar(@bug_in_groups) && (!$ccuser || !$ccuser->can_see_bug($bug->bug_id)));
|
||||
next if $attachment_is_private && (!$ccuser || !$ccuser->is_insider);
|
||||
# Prevent duplicated entries due to case sensitivity.
|
||||
$cc = $ccuser ? $ccuser->email : $cc;
|
||||
$recipients{$cc} = $ccuser;
|
||||
foreach my $ccuser (@{ Bugzilla::User->match({ login_name => [ split /[, ]+/, $cc_list ] }) })
|
||||
{
|
||||
next if !$ccuser->can_see_bug($bug->bug_id);
|
||||
next if $attachment_is_private && !$ccuser->is_insider;
|
||||
# Prevent duplicated entries.
|
||||
$recipients{$ccuser->email} = $ccuser;
|
||||
}
|
||||
|
||||
# Only notify if the addressee is allowed to receive the email.
|
||||
if ($addressee && $addressee->email_enabled) {
|
||||
$recipients{$addressee->email} = $addressee;
|
||||
}
|
||||
# /УБРАТЬ
|
||||
|
||||
# Process and send notification for each recipient.
|
||||
# If there are users in the CC list who don't have an account,
|
||||
|
|
|
@ -191,7 +191,7 @@ sub users_in_group
|
|||
}
|
||||
}
|
||||
|
||||
my $users = Bugzilla::Object::match('Bugzilla::User', {
|
||||
my $users = Bugzilla::User->match({
|
||||
Bugzilla::User->ID_FIELD => [ keys %$res ],
|
||||
is_enabled => 1,
|
||||
});
|
||||
|
|
|
@ -1242,7 +1242,7 @@ sub init
|
|||
if ($name && lc $name ne '%user%' && !login_to_id($name))
|
||||
{
|
||||
# Do a match on user login or name
|
||||
my $u = Bugzilla::User::match($name, 1)->[0];
|
||||
my $u = Bugzilla::User::match_name($name, 1)->[0];
|
||||
if ($u)
|
||||
{
|
||||
$name = $u->login;
|
||||
|
@ -2042,7 +2042,7 @@ sub changed
|
|||
my $who = $v->{who};
|
||||
if ($who)
|
||||
{
|
||||
$who = $who eq '%user%' ? $self->{user} : Bugzilla::User::match($who, 1)->[0];
|
||||
$who = $who eq '%user%' ? $self->{user} : Bugzilla::User::match_name($who, 1)->[0];
|
||||
if ($who)
|
||||
{
|
||||
$Bugzilla::Search::interval_who = $who;
|
||||
|
|
|
@ -1179,7 +1179,7 @@ sub can_bless {
|
|||
return grep($_->id == $group_id, @{ $self->bless_groups }) ? 1 : 0;
|
||||
}
|
||||
|
||||
sub match {
|
||||
sub match_name {
|
||||
# Generates a list of users whose login name (email address) or real name
|
||||
# matches a substring or wildcard.
|
||||
# This is also called if matches are disabled (for error checking), but
|
||||
|
@ -1386,7 +1386,7 @@ sub match_field {
|
|||
|
||||
my @logins;
|
||||
for my $query (@queries) {
|
||||
my $users = match(
|
||||
my $users = match_name(
|
||||
$query, # match string
|
||||
$limit, # match limit
|
||||
1 # exclude_disabled
|
||||
|
@ -2517,7 +2517,7 @@ the two passwords match.
|
|||
|
||||
=item B<Description>
|
||||
|
||||
Wrapper for the C<match()> function.
|
||||
Wrapper for the C<match_name()> function.
|
||||
|
||||
=item B<Params>
|
||||
|
||||
|
|
|
@ -203,7 +203,7 @@ sub get {
|
|||
$limit = $params->{'maxusermatches'} + 1;
|
||||
}
|
||||
foreach my $match_string (@{ $params->{'match'} || [] }) {
|
||||
my $matched = Bugzilla::User::match($match_string, $limit, $params->{excludedisabled} && 1);
|
||||
my $matched = Bugzilla::User::match_name($match_string, $limit, $params->{excludedisabled} && 1);
|
||||
foreach my $user (@$matched) {
|
||||
if (!$unique_users{$user->id}) {
|
||||
push(@user_objects, $user);
|
||||
|
|
|
@ -50,7 +50,7 @@ if (@add_members || @add_bless || @rm_members || @rm_bless)
|
|||
if (@add_members || @add_bless)
|
||||
{
|
||||
my $users = { map { lc($_->login) => $_ } @{
|
||||
Bugzilla::Object::match('Bugzilla::User', { login_name => [ @add_members, @add_bless ] })
|
||||
Bugzilla::User->match({ login_name => [ @add_members, @add_bless ] })
|
||||
} };
|
||||
for (\@add_members, \@add_bless)
|
||||
{
|
||||
|
|
|
@ -313,7 +313,7 @@ if ($cloned_bug_id)
|
|||
}
|
||||
elsif ($ARGS->{cc})
|
||||
{
|
||||
@cc = @{ Bugzilla::Object::match('Bugzilla::User', { login_name => [ split /[\s,]+/, $ARGS->{cc} ] }) };
|
||||
@cc = @{ Bugzilla::User->match({ login_name => [ split /[\s,]+/, $ARGS->{cc} ] }) };
|
||||
}
|
||||
elsif (@{$cloned_bug->cc_users})
|
||||
{
|
||||
|
|
|
@ -185,7 +185,7 @@ sub ParseWtDate
|
|||
sub MatchWtUser
|
||||
{
|
||||
my ($wt_user) = @_;
|
||||
my $matches = Bugzilla::User::match($wt_user);
|
||||
my $matches = Bugzilla::User::match_name($wt_user);
|
||||
if (scalar(@$matches) != 1)
|
||||
{
|
||||
Bugzilla->cgi->delete('worktime_user');
|
||||
|
|
Loading…
Reference in New Issue