CProd and Portal
Patch by kareila.
diffs (121 lines):
diff -r 06ffc6b6f562 -r ad818972bb86 cgi-bin/LJ/CProd/Feeds.pm
--- a/cgi-bin/LJ/CProd/Feeds.pm Sat Jun 06 16:36:27 2009 +0000
+++ b/cgi-bin/LJ/CProd/Feeds.pm Sat Jun 06 17:03:25 2009 +0000
@@ -6,7 +6,7 @@ sub applicable {
my $popsyn = LJ::Syn::get_popular_feeds();
- my $friends = LJ::get_friends($u) || {};
+ my %friends = map { $_ => 1 } $u->watched_userids;
my @pop;
for (0 .. 99) {
@@ -14,7 +14,7 @@ sub applicable {
my ($user, $name, $suserid, $url, $count) = @{ $popsyn->[$_] };
my $suser = LJ::load_userid($suserid);
- return 0 if ($friends->{$suserid} || $suser->{'statusvis'} ne "V");
+ return 0 if ($friends{$suserid} || $suser->{'statusvis'} ne "V");
}
return 1;
}
diff -r 06ffc6b6f562 -r ad818972bb86 cgi-bin/LJ/Portal/Box/Birthdays.pm
--- a/cgi-bin/LJ/Portal/Box/Birthdays.pm Sat Jun 06 16:36:27 2009 +0000
+++ b/cgi-bin/LJ/Portal/Box/Birthdays.pm Sat Jun 06 17:03:25 2009 +0000
@@ -19,7 +19,7 @@ sub generate_content {
sub generate_content {
my $self = shift;
my $u = $self->{'u'};
- my @bdays = $u->get_friends_birthdays
+ my @bdays = $u->get_birthdays
or return "(No upcoming friends' birthdays.)";
my $content = '';
diff -r 06ffc6b6f562 -r ad818972bb86 cgi-bin/LJ/Portal/Box/Friends.pm
--- a/cgi-bin/LJ/Portal/Box/Friends.pm Sat Jun 06 16:36:27 2009 +0000
+++ b/cgi-bin/LJ/Portal/Box/Friends.pm Sat Jun 06 17:03:25 2009 +0000
@@ -47,17 +47,13 @@ sub generate_content {
my $maxshow= $self->get_prop('maxshow');
# display current friends of u
- my $friends = LJ::get_friends($u->{'userid'});
+ my $friends_u = $u->circle_users;
my $friendcount = 0;
my $foundfriends = 0;
my $friendlist;
my $displaying;
- my @friendids = keys %$friends;
- my $friends_u = {};
- if (keys %$friends) {
- $friends_u = LJ::load_userids(@friendids);
-
+ if ($friends_u) {
grep { $friendcount++ if $friends_u->{$_}->{'journaltype'} eq 'P'; }
keys %$friends_u;
my @sortedfriends = sort { $friends_u->{$a}->{'user'} cmp
$friends_u->{$b}->{'user'} } keys %$friends_u;
@@ -113,7 +109,7 @@ sub generate_content {
my $commcount=0, my $commlist;
if ($showcomm) {
- if ($friends) {
+ if ($friends_u) {
grep { $commcount++ if $friends_u->{$_}->{'journaltype'} eq 'C'; }
keys %$friends_u;
my @sortedfriends = sort { $friends_u->{$a}->{'user'} cmp
$friends_u->{$b}->{'user'} } keys %$friends_u;
@@ -147,7 +143,7 @@ sub generate_content {
my $syncount=0, my $synlist;
if ($showsyn) {
- if ($friends) {
+ if ($friends_u) {
grep { $syncount++ if $friends_u->{$_}->{'journaltype'} eq 'Y'; }
keys %$friends_u;
my @sortedfriends = sort { $friends_u->{$a}->{'user'} cmp
$friends_u->{$b}->{'user'} } keys %$friends_u;
diff -r 06ffc6b6f562 -r ad818972bb86 cgi-bin/LJ/Portal/Box/PopWithFriends.pm
--- a/cgi-bin/LJ/Portal/Box/PopWithFriends.pm Sat Jun 06 16:36:27 2009 +0000
+++ b/cgi-bin/LJ/Portal/Box/PopWithFriends.pm Sat Jun 06 17:03:25 2009 +0000
@@ -64,10 +64,8 @@ sub generate_content {
}
# load user's friends
- my $fr = LJ::get_friends($u);
- return 'No friends found.' unless $fr;
-
- my @ids = keys %$fr;
+ my @ids = $u->circle_userids or return 'No friends found.';
+ my %fr = map { $_ => 1 } @ids;
splice(@ids, 0, $LIMIT) if @ids > $LIMIT;
my $fus = LJ::load_userids(@ids);
@@ -83,10 +81,8 @@ sub generate_content {
my $start = time();
while (@ids && time() < $start + $MAX_DELAY) {
my $fid = shift @ids;
-
- my $fr = LJ::get_friends($fid);
- next unless $fr;
- $count{$_}++ foreach (keys %$fr);
+ my $fu = $fus->{$fid} or next;
+ $count{$_}++ foreach ($fu->circle_userids);
}
my @pop = (sort { $count{$b} <=> $count{$a} } keys %count);
@@ -102,7 +98,7 @@ sub generate_content {
next if ($popid eq $u->{'userid'});
# don't show own friends if option set
- next if ($fr->{$popid} && !$showown);
+ next if ($fr{$popid} && !$showown);
my $fofu = $fofus->{$popid};
@@ -118,7 +114,7 @@ sub generate_content {
$rows .= "<tr><td>" . LJ::ljuser($fofu) . " - " .
LJ::ehtml($fofu->{name}) .
"</td><td align='right'>$friendcount</td>";
- $rows .= "<td><a
href=\"$LJ::SITEROOT/manage/circle/add.bml?user=$fofu->{user}\"><img
src=\"$LJ::IMGPREFIX/btn_addfriend.gif\" alt=\"Add this user as a friend\"
/></a></td>" if !$fr->{$fofu->{userid}};
+ $rows .= "<td><a
href=\"$LJ::SITEROOT/manage/circle/add.bml?user=$fofu->{user}\"><img
src=\"$LJ::IMGPREFIX/btn_addfriend.gif\" alt=\"Add this user as a friend\"
/></a></td>" if !$fr{$fofu->{userid}};
$rows .= "</tr>\n";
}
_______________________________________________
dw-changelog mailing list
[email protected]
http://lists.dwscoalition.org/mailman/listinfo/dw-changelog