From 37722eca39874bb6abdcd120e3e458bd62dea62b Mon Sep 17 00:00:00 2001 From: Dylan William Hardison Date: Wed, 5 Jul 2017 11:43:18 -0700 Subject: Bug 1377933 - Remove trailing whitespace from all perl files --- Bugzilla/User.pm | 108 +++++++++++++++++++++++++++---------------------------- 1 file changed, 54 insertions(+), 54 deletions(-) (limited to 'Bugzilla/User.pm') diff --git a/Bugzilla/User.pm b/Bugzilla/User.pm index 294bdf758..e7a5ed481 100644 --- a/Bugzilla/User.pm +++ b/Bugzilla/User.pm @@ -56,7 +56,7 @@ use constant DEFAULT_USER => { 'showmybugslink' => 0, 'disabledtext' => '', 'disable_mail' => 0, - 'is_enabled' => 1, + 'is_enabled' => 1, }; use constant DB_TABLE => 'profiles'; @@ -328,7 +328,7 @@ sub update { # XXX Can update profiles_activity here as soon as it understands # field names like login_name. - + return $changes; } @@ -371,7 +371,7 @@ sub check_login_name_for_creation { # Check the name if it's a new user, or if we're changing the name. if (!ref($invocant) || $invocant->login ne $name) { - is_available_username($name) + is_available_username($name) || ThrowUserError('account_exists', { email => $name }); } @@ -381,8 +381,8 @@ sub check_login_name_for_creation { sub _check_password { my ($self, $pass) = @_; - # If the password is '*', do not encrypt it or validate it further--we - # are creating a user who should not be able to log in using DB + # If the password is '*', do not encrypt it or validate it further--we + # are creating a user who should not be able to log in using DB # authentication. return $pass if $pass eq '*'; @@ -395,7 +395,7 @@ sub _check_realname { return trim($_[1]) || ''; } sub _check_is_enabled { my ($invocant, $is_enabled, undef, $params) = @_; - # is_enabled is set automatically on creation depending on whether + # is_enabled is set automatically on creation depending on whether # disabledtext is empty (enabled) or not empty (disabled). # When updating the user, is_enabled is set by calling set_disabledtext(). # Any value passed into this validator is ignored. @@ -662,7 +662,7 @@ sub identity { return "" unless $self->id; if (!defined $self->{identity}) { - $self->{identity} = + $self->{identity} = $self->name ? $self->name . " <" . $self->login. ">" : $self->login; } @@ -716,7 +716,7 @@ sub queries_subscribed { FROM namedqueries_link_in_footer lif INNER JOIN namedquery_group_map ngm ON ngm.namedquery_id = lif.namedquery_id - WHERE lif.user_id = ? + WHERE lif.user_id = ? AND lif.namedquery_id NOT IN ($query_id_string) AND " . $self->groups_in_sql, undef, $self->id); @@ -794,7 +794,7 @@ sub is_bug_ignored { sub recent_searches { my $self = shift; - $self->{recent_searches} ||= + $self->{recent_searches} ||= Bugzilla::Search::Recent->match({ user_id => $self->id }); return $self->{recent_searches}; } @@ -861,7 +861,7 @@ sub recent_search_for { sub save_last_search { my ($self, $params) = @_; - my ($bug_ids, $order, $vars, $list_id) = + my ($bug_ids, $order, $vars, $list_id) = @$params{qw(bugs order vars list_id)}; my $cgi = Bugzilla->cgi; @@ -892,13 +892,13 @@ sub save_last_search { else { # If we already have an existing search with a totally # identical bug list, then don't create a new one. This - # prevents people from writing over their whole + # prevents people from writing over their whole # recent-search list by just refreshing a saved search # (which doesn't have list_id in the header) over and over. my $list_string = join(',', @$bug_ids); my $existing_search = Bugzilla::Search::Recent->match({ user_id => $self->id, bug_list => $list_string }); - + if (!scalar(@$existing_search)) { $search = Bugzilla::Search::Recent->create({ user_id => $self->id, @@ -1412,7 +1412,7 @@ sub visible_bugs { LEFT JOIN cc ON cc.bug_id = bugs.bug_id AND cc.who = $user_id - LEFT JOIN bug_group_map + LEFT JOIN bug_group_map ON bugs.bug_id = bug_group_map.bug_id AND bug_group_map.group_id NOT IN (" . $self->groups_as_string . ') @@ -1425,9 +1425,9 @@ sub visible_bugs { $sth->execute(@check_ids); my $use_qa_contact = Bugzilla->params->{'useqacontact'}; while (my $row = $sth->fetchrow_arrayref) { - my ($bug_id, $reporter, $owner, $qacontact, $reporter_access, + my ($bug_id, $reporter, $owner, $qacontact, $reporter_access, $cclist_access, $isoncclist, $missinggroup) = @$row; - $visible_cache->{$bug_id} ||= + $visible_cache->{$bug_id} ||= ((($reporter == $user_id) && $reporter_access) || ($use_qa_contact && $qacontact && ($qacontact == $user_id)) @@ -1509,7 +1509,7 @@ sub can_enter_product { ThrowUserError('no_products'); } - my $product = blessed($input) ? $input + my $product = blessed($input) ? $input : new Bugzilla::Product({ name => $input }); my $can_enter = $product && grep($_->name eq $product->name, @@ -1596,12 +1596,12 @@ sub can_access_product { sub get_accessible_products { my $self = shift; - + # Map the objects into a hash using the ids as keys my %products = map { $_->id => $_ } @{$self->get_selectable_products}, @{$self->get_enterable_products}; - + return [ sort { $a->name cmp $b->name } values %products ]; } @@ -1752,7 +1752,7 @@ sub visible_groups_direct { my $dbh = Bugzilla->dbh; my $sth; - + if (Bugzilla->params->{'usevisibilitygroups'}) { $sth = $dbh->prepare("SELECT DISTINCT grantor_id FROM group_group_map @@ -1893,7 +1893,7 @@ sub can_bless { my $self = shift; if (!scalar(@_)) { - # If we're called without an argument, just return + # If we're called without an argument, just return # whether or not we can bless at all. return scalar(@{ $self->bless_groups }) ? 1 : 0; } @@ -2017,11 +2017,11 @@ sub match_field { my @field_names = grep(/$field_pattern/, keys %$data); foreach my $field_name (@field_names) { - $expanded_fields->{$field_name} = + $expanded_fields->{$field_name} = { type => $fields->{$field_pattern}->{'type'} }; - - # The field is a requestee field; in order for its name - # to show up correctly on the confirmation page, we need + + # The field is a requestee field; in order for its name + # to show up correctly on the confirmation page, we need # to find out the name of its flag type. if ($field_name =~ /^requestee(_type)?-(\d+)$/) { my $flag_type; @@ -2216,8 +2216,8 @@ sub wants_bug_mail { my ($bug, $relationship, $fieldDiffs, $comments, $dep_mail, $changer) = @_; # Make a list of the events which have happened during this bug change, - # from the point of view of this user. - my %events; + # from the point of view of this user. + my %events; foreach my $change (@$fieldDiffs) { my $fieldName = $change->{field_name}; # A change to any of the above fields sets the corresponding event @@ -2236,7 +2236,7 @@ sub wants_bug_mail { { $events{+EVT_ADDED_REMOVED} = 1; } - + if ($fieldName eq "cc") { my $login = $self->login; my $inold = ($change->{old} =~ /^(.*,\s*)?\Q$login\E(,.*)?$/); @@ -2268,7 +2268,7 @@ sub wants_bug_mail { elsif (defined($$comments[0])) { $events{+EVT_COMMENT} = 1; } - + # Dependent changed bugmails must have an event to ensure the bugmail is # emailed. if ($dep_mail) { @@ -2276,18 +2276,18 @@ sub wants_bug_mail { } my @event_list = keys %events; - + my $wants_mail = $self->wants_mail(\@event_list, $relationship); # The negative events are handled separately - they can't be incorporated # into the first wants_mail call, because they are of the opposite sense. - # + # # We do them separately because if _any_ of them are set, we don't want # the mail. if ($wants_mail && $changer && ($self->id == $changer->id)) { $wants_mail &= $self->wants_mail([EVT_CHANGED_BY_ME], $relationship); - } - + } + if ($wants_mail && $bug->bug_status eq 'UNCONFIRMED') { $wants_mail &= $self->wants_mail([EVT_UNCONFIRMED], $relationship); } @@ -2311,13 +2311,13 @@ sub wants_bug_mail { sub wants_mail { my $self = shift; my ($events, $relationship) = @_; - - # Don't send any mail, ever, if account is disabled + + # Don't send any mail, ever, if account is disabled # XXX Temporary Compatibility Change 1 of 2: # This code is disabled for the moment to make the behaviour like the old # system, which sent bugmail to disabled accounts. # return 0 if $self->{'disabledtext'}; - + # No mail if there are no events return 0 if !scalar(@$events); @@ -2459,7 +2459,7 @@ sub create { foreach my $rel (keys %relationships) { foreach my $event (POS_EVENTS, NEG_EVENTS) { # These "exceptions" define the default email preferences. - # + # # We enable mail unless the change was made by the user, or it's # just a CC list addition and the user is not the reporter. next if ($event == EVT_CHANGED_BY_ME); @@ -2538,7 +2538,7 @@ sub clear_login_failures { sub account_ip_login_failures { my $self = shift; my $dbh = Bugzilla->dbh; - my $time = $dbh->sql_date_math('LOCALTIMESTAMP(0)', '-', + my $time = $dbh->sql_date_math('LOCALTIMESTAMP(0)', '-', LOGIN_LOCKOUT_INTERVAL, 'MINUTE'); my $ip_addr = remote_ip(); trick_taint($ip_addr); @@ -2629,7 +2629,7 @@ sub login_to_id { my $dbh = Bugzilla->dbh; my $cache = Bugzilla->request_cache->{user_login_to_id} ||= {}; - # We cache lookups because this function showed up as taking up a + # We cache lookups because this function showed up as taking up a # significant amount of time in profiles of xt/search.t. However, # for users that don't exist, we re-do the check every time, because # otherwise we break is_available_username. @@ -2642,7 +2642,7 @@ sub login_to_id { # statement only, so it's safe to simply trick_taint. trick_taint($login); $user_id = $dbh->selectrow_array( - "SELECT userid FROM profiles + "SELECT userid FROM profiles WHERE " . $dbh->sql_istrcmp('login_name', '?'), undef, $login); $cache->{$login} = $user_id; } @@ -2715,14 +2715,14 @@ Bugzilla::User - Object for a Bugzilla user my $user = new Bugzilla::User($id); - my @get_selectable_classifications = + my @get_selectable_classifications = $user->get_selectable_classifications; # Class Functions - $user = Bugzilla::User->create({ - login_name => $username, - realname => $realname, - cryptpassword => $plaintext_password, + $user = Bugzilla::User->create({ + login_name => $username, + realname => $realname, + cryptpassword => $plaintext_password, disabledtext => $disabledtext, disable_mail => 0}); @@ -2744,12 +2744,12 @@ methods listed below. =item C -Returned by C when at least one field matched more than +Returned by C when at least one field matched more than one user, but no matches failed. =item C -Returned by C when at least one field failed to match +Returned by C when at least one field failed to match anything. =item C @@ -2759,7 +2759,7 @@ user. =item C -Passed in to match_field to tell match_field to never display a +Passed in to match_field to tell match_field to never display a confirmation screen. =back @@ -2773,7 +2773,7 @@ confirmation screen. =item C Returns a user who is in all groups, but who does not really exist in the -database. Used for non-web scripts like L that need to make +database. Used for non-web scripts like L that need to make database changes and so on. =back @@ -2784,7 +2784,7 @@ database changes and so on. =item C -Returns an arrayref of the user's own saved queries, sorted by name. The +Returns an arrayref of the user's own saved queries, sorted by name. The array contains L objects. =item C @@ -2964,7 +2964,7 @@ is_enabled - true if the user is allowed to set the preference themselves; for themselves or must accept the global site default value default_value - the global site default for this setting value - the value of this setting for this user. Will be the same - as the default_value if the user is not logged in, or if + as the default_value if the user is not logged in, or if is_default is true. is_default - a boolean to indicate whether the user has chosen to make a preference for themself or use the site default. @@ -3004,7 +3004,7 @@ this product. =item C -Determines whether or not a user is in the given group by id. +Determines whether or not a user is in the given group by id. =item C @@ -3049,7 +3049,7 @@ method should be called in such a case to force reresolution of these groups. =item C -Clears the stored values for L, +Clears the stored values for L, L, etc. so that their data will be read from the database again. Used mostly by L. @@ -3294,11 +3294,11 @@ indicating why the request has been rejected. Returns a boolean indicating whether or not the supplied username is already taken in Bugzilla. -Params: $username (scalar, string) - The full login name of the username +Params: $username (scalar, string) - The full login name of the username that you are checking. $old_username (scalar, string) - If you are checking an email-change token, insert the "old" username that the user is changing from, - here. Then, as long as it's the right user for that token, he + here. Then, as long as it's the right user for that token, he can change his username to $username. (That is, this function will return a boolean true value). -- cgit v1.2.3-24-g4f1b