fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2011-10-02 05:29 pm

[dw-free] Show communities maintained on profile

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

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

Show communities you are an administrator of on your own profile; respects
the setting to hide the section of communities you are a member of (will be
member or admin of, next code push)

Patch by [personal profile] kareila.

Files modified:
  • htdocs/manage/profile/index.bml
  • htdocs/manage/profile/index.bml.text
  • htdocs/profile.bml
  • htdocs/profile.bml.text
--------------------------------------------------------------------------------
diff -r 8664015de23e -r 052068eab16d htdocs/manage/profile/index.bml
--- a/htdocs/manage/profile/index.bml	Fri Sep 30 11:49:38 2011 +0800
+++ b/htdocs/manage/profile/index.bml	Mon Oct 03 01:29:38 2011 +0800
@@ -539,7 +539,7 @@
             $ret .= LJ::html_check( { type => 'check', name => 'opt_hidememberofs',
                                       id => 'opt_hidememberofs', selected => ! $u->{'opt_hidememberofs'} } );
             $ret .= "</td><td style='vertical-align: middle'>";
-            $ret .= "<label for='opt_hidememberofs'>$ML{'.comms'}</label></td></tr>\n";
+            $ret .= "<label for='opt_hidememberofs'>$ML{'.comms2'}</label></td></tr>\n";
         }
 
         $ret .= "</table>\n";
diff -r 8664015de23e -r 052068eab16d htdocs/manage/profile/index.bml.text
--- a/htdocs/manage/profile/index.bml.text	Fri Sep 30 11:49:38 2011 +0800
+++ b/htdocs/manage/profile/index.bml.text	Mon Oct 03 01:29:38 2011 +0800
@@ -15,7 +15,7 @@
 
 .chat.yahooid=Yahoo! ID
 
-.comms=Display communities of which you are a member.
+.comms2=Display communities of which you are a member or administrator.
 
 .display.title=Display Settings for [[name]]
 
diff -r 8664015de23e -r 052068eab16d htdocs/profile.bml
--- a/htdocs/profile.bml	Fri Sep 30 11:49:38 2011 +0800
+++ b/htdocs/profile.bml	Mon Oct 03 01:29:38 2011 +0800
@@ -758,18 +758,19 @@
             unless $u->prop( 'opt_hidefriendofs' ) && ( !$remote || !$remote->can_manage( $u ) );
     }
 
-    my ( @members_userids, @member_of_userids, @posting_access_to_userids, @posting_access_from_userids );
+    my ( @members_userids, @member_of_userids, @admin_of_userids, @posting_access_to_userids, @posting_access_from_userids );
     @members_userids = $u->member_userids if $u->is_community;
     @member_of_userids = $u->member_of_userids if $u->is_personal;
-    @posting_access_to_userids = @{LJ::load_rel_target( $u, 'P' )} if $u->is_personal;
-    @posting_access_from_userids = @{LJ::load_rel_user( $u, 'P' )} if $u->is_community;
+    @admin_of_userids = @{LJ::load_rel_target_cache( $u, 'A' )} if $u->is_personal;
+    @posting_access_to_userids = @{LJ::load_rel_target_cache( $u, 'P' )} if $u->is_personal;
+    @posting_access_from_userids = @{LJ::load_rel_user_cache( $u, 'P' )} if $u->is_community;
 
     my $us = LJ::load_userids(
         @trusted_userids, @trusted_by_userids,
         @mutually_trusted_userids, @not_mutually_trusted_userids, @not_mutually_trusted_by_userids,
         @watched_userids, @watched_by_userids,
         @mutually_watched_userids, @not_mutually_watched_userids, @not_mutually_watched_by_userids,
-        @members_userids, @member_of_userids,
+        @members_userids, @member_of_userids, @admin_of_userids,
         @posting_access_to_userids, @posting_access_from_userids,
     );
 
@@ -779,7 +780,7 @@
                   \@mutually_trusted_userids, \@mutually_watched_userids, \@mutually_watched_userids,
                   \@not_mutually_trusted_userids, \@not_mutually_watched_userids,
                   \@not_mutually_trusted_by_userids, \@not_mutually_watched_by_userids, \@members_userids,
-                  \@member_of_userids, \@posting_access_to_userids, \@posting_access_from_userids );
+                  \@member_of_userids, \@admin_of_userids, \@posting_access_to_userids, \@posting_access_from_userids );
 
 ################################################################################
 ##### PEOPLE LISTS
@@ -957,7 +958,7 @@
 ##### COMMUNITY LISTS
 
     if ( $u->is_individual ) {
-        my ( $member_of_body, $posting_access_to_body, $watched_body );
+        my ( $member_of_body, $admin_of_body, $posting_access_to_body, $watched_body );
 
         if ( $u->is_personal ) {
             my @member_of_list = map { $us->{$_} } @member_of_userids;
@@ -970,6 +971,15 @@
                 hidable         => 1,
             );
 
+            my @admin_of_list = map { $us->{$_} } @admin_of_userids;
+            $admin_of_body = $content_inner_block->(
+                section_name    => 'admin_of_comms',
+                section_name_ml => $mlsn->( '.comms.admin_of', \@admin_of_list ),
+                section_link    => 'admin_of',
+                body            => $listusers->( \@admin_of_list ),
+                hidable         => 1,
+            );
+
             my @posting_access_to_list = map { $us->{$_} } @posting_access_to_userids;
             $posting_access_to_body = $content_inner_block->(
                 section_name    => 'posting_access_to_comms',
@@ -989,7 +999,7 @@
             body            => $listusers->( \@watched_list ),
         );
 
-        if ( $member_of_body || $posting_access_to_body || $watched_body ) {
+        if ( $member_of_body || $admin_of_body || $posting_access_to_body || $watched_body ) {
             my $links = [];
             if ( $remote && $remote->can_manage( $u ) ) {
                 push @$links, { url => "$LJ::SITEROOT/manage/circle/edit", text => $ML{'.section.edit'} };
@@ -1002,7 +1012,7 @@
                 section_link    => 'communities',
                 header_image    => "$LJ::IMGPREFIX/silk/identity/community.png",
                 links           => $links,
-                body            => "$member_of_body$watched_body$posting_access_to_body",
+                body            => "$member_of_body$watched_body$admin_of_body$posting_access_to_body",
                 collapsible     => 0,
             );
         }
diff -r 8664015de23e -r 052068eab16d htdocs/profile.bml.text
--- a/htdocs/profile.bml.text	Fri Sep 30 11:49:38 2011 +0800
+++ b/htdocs/profile.bml.text	Mon Oct 03 01:29:38 2011 +0800
@@ -21,6 +21,10 @@
 
 .comminfo.name=Community Information
 
+.comms.admin_of.none=Administrator Of (0)
+
+.comms.admin_of.some=Administrator Of ([[num]]):
+
 .comms.header=Communities
 
 .comms.member_of.none=Member Of (0)
--------------------------------------------------------------------------------