Committer: amyshkin
LJSUP-10147: Implement abstract interace for access to friends relationsU trunk/cgi-bin/LJ/User.pm
Modified: trunk/cgi-bin/LJ/User.pm =================================================================== --- trunk/cgi-bin/LJ/User.pm 2011-11-10 08:56:33 UTC (rev 20525) +++ trunk/cgi-bin/LJ/User.pm 2011-11-10 09:08:57 UTC (rev 20526) @@ -4542,10 +4542,14 @@ # -- eg, not initial friends auto-added for them sub friends_added_count { my $u = shift; + my %init_friends_ids; - my @friend_ids = $u->friend_uids; - my %init_friends_ids = map { $_ => 1 } LJ::get_uids( @LJ::INITIAL_FRIENDS, @LJ::INITIAL_OPTIONAL_FRIENDS, $u->user ); - return scalar grep { ! $init_friends_ids{$_} } @friend_ids; + for ( @LJ::INITIAL_FRIENDS, @LJ::INITIAL_OPTIONAL_FRIENDS, $u->user ) { + my $u = LJ::load_user($_); + $init_friends_ids{ $u->id }++ if $u; + } + + return scalar grep { ! $init_friends_ids{$_} } $u->friend_uids; } sub set_password { @@ -7670,13 +7674,6 @@ $cache->{'_email'} = $email; } -sub get_uids { - my @friends_names = @_; - my @ret; - push @ret, grep { $_ } map { LJ::load_user($_) } @friends_names; - return @ret; -} - sub set_password { my ($userid, $password) = @_;