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-07-12 09:47 pm

[dw-free] another LJ::get_friend_group rabbit hole

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

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

Fix emailpost.bml to use trust groups API instead of the login protocol.

Patch by [personal profile] kareila.

Files modified:
  • htdocs/manage/emailpost.bml
--------------------------------------------------------------------------------
diff -r 8c9107777876 -r 2820a1a7fa83 htdocs/manage/emailpost.bml
--- a/htdocs/manage/emailpost.bml	Sun Jul 12 21:34:10 2009 +0000
+++ b/htdocs/manage/emailpost.bml	Sun Jul 12 21:47:55 2009 +0000
@@ -443,14 +443,16 @@ body<=
         {
             "ver" => ( $LJ::UNICODE ? "1" : "0" ),
             "username"     => $u->{'user'},
-            "friendgroups" => 1,
+#            "friendgroups" => 1,
             "getpickws"    => 1,
         },
         undef,
         { "noauth" => 1, }
     );
 
-    my @groups = map { $_->{'name'} } @{ $res->{'friendgroups'} };
+    my $trusted = $u->trust_groups;
+    my @groups = map { $trusted->{$_}->{'groupname'} }
+        sort { $trusted->{$a}->{'sortorder'} <=> $trusted->{$b}->{'sortorder'} } keys %$trusted;
     my @userpics = @{ $res->{'pickws'} };
     
     $ret .= "<?p " . BML::ml('.intro', {'aopts' => "href='$LJ::SITEROOT/manage/emailpost.bml?mode=help'"}) . " p?><br />";
--------------------------------------------------------------------------------