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-06-14 06:24 pm

[dw-free] update journal -> community settings page

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

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

WTF-ize code to convert personal accounts to communities.

Patch by [personal profile] kareila.

Files modified:
  • htdocs/community/settings.bml
--------------------------------------------------------------------------------
diff -r 5664610085c4 -r 5741ef08f4f1 htdocs/community/settings.bml
--- a/htdocs/community/settings.bml	Sun Jun 14 18:18:10 2009 +0000
+++ b/htdocs/community/settings.bml	Sun Jun 14 18:24:05 2009 +0000
@@ -100,7 +100,6 @@ body<=
         # proceed.
         unless (%errors) {
             my $dbh = LJ::get_db_writer();
-            my $cid = $cu->id;
 
             my $qmembership = $POST{membership};
             $qmembership = "closed" unless $qmembership =~ /^(?:open|moderated|closed)$/;
@@ -119,9 +118,13 @@ body<=
             if ($mode eq 'create') {
                 LJ::set_rel($cu, $remote, 'A');
 
-                # delete existing friends
-                my $friends = LJ::get_friends($cid, undef, undef, 'force') || {};
-                LJ::remove_friend($cid, [ keys %$friends ]);
+                # delete existing watchlist & trustlist
+                foreach ( $cu->watched_users ) {
+                    $cu->remove_edge( $_, watch => {} );
+                }
+                foreach ( $cu->trusted_users ) {
+                    $cu->remove_edge( $_, trust => {} );
+                }
 
                 # log this to statushistory
                 my $msg = "account '" . $cu->user . "' converted to community";
--------------------------------------------------------------------------------

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