mark: A photo of Mark kneeling on top of the Taal Volcano in the Philippines. It was a long hike. (Default)
Mark Smith ([staff profile] mark) wrote in [site community profile] changelog2009-03-07 07:42 am

[dw-free] update FOAF ljfeed.pl to use WTF

[commit: http://hg.dwscoalition.org/dw-free/rev/fc9b79485704]

http://bugs.dwscoalition.org/show_bug.cgi?id=441

Update ljfeed to work with WTF.

Patch by [personal profile] janinedog.

Files modified:
  • cgi-bin/ljfeed.pl
--------------------------------------------------------------------------------
diff -r 0bcd59c4c0ae -r fc9b79485704 cgi-bin/ljfeed.pl
--- a/cgi-bin/ljfeed.pl	Sat Mar 07 07:38:01 2009 +0000
+++ b/cgi-bin/ljfeed.pl	Sat Mar 07 07:42:01 2009 +0000
@@ -752,22 +752,25 @@ sub create_view_foaf {
     }
 
     # check if the user has a "FOAF-knows" group
-    my $groups = LJ::get_friend_group($u->{userid}, { name => 'FOAF-knows' });
-    my $mask = $groups ? 1 << $groups->{groupnum} : 0;
+    my $has_foaf_group = $u->trust_groups( name => 'FOAF-knows' ) ? 1 : 0;
 
     # now information on who you know, limited to a certain maximum number of users
-    my $friends = LJ::get_friends($u->{userid}, $mask);
-    my @ids = keys %$friends;
+    my @ids;
+    if ( $has_foaf_group ) {
+        @ids = keys %{ $u->trust_group_list( name => 'FOAF-knows' ) };
+    } else {
+        @ids = $u->trusted_userids;
+    }
+
     @ids = splice(@ids, 0, $LJ::MAX_FOAF_FRIENDS) if @ids > $LJ::MAX_FOAF_FRIENDS;
 
     # now load
-    my %users;
-    LJ::load_userids_multiple([ map { $_, \$users{$_} } @ids ], [$u]);
+    my $users = LJ::load_userids( @ids );
 
     # iterate to create data structure
-    foreach my $friendid (@ids) {
-        next if $friendid == $u->{userid};
-        my $fu = $users{$friendid};
+    foreach my $trustid ( @ids ) {
+        next if $trustid == $u->id;
+        my $fu = $users->{$trustid};
         next if $fu->{statusvis} =~ /[DXS]/ || $fu->{journaltype} ne 'P';
 
         my $name = LJ::exml($fu->name_raw);
--------------------------------------------------------------------------------

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org