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

[dw-free] enable maintainers to leave comm if comm is deleted

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

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

Enable people to disown a community when they're the last maintainer, there
are no members, and it's deleted.

Patch by [personal profile] afuna.

Files modified:
  • cgi-bin/DW/User/Edges/CommMembership.pm
  • htdocs/community/leave.bml
  • htdocs/community/leave.bml.text
--------------------------------------------------------------------------------
diff -r f814352fdaab -r dfd44ce17c2a cgi-bin/DW/User/Edges/CommMembership.pm
--- a/cgi-bin/DW/User/Edges/CommMembership.pm	Fri Jun 12 21:11:11 2009 +0000
+++ b/cgi-bin/DW/User/Edges/CommMembership.pm	Fri Jun 12 21:13:01 2009 +0000
@@ -205,8 +205,13 @@ sub can_leave {
         my $othermaints = grep { $_ != $u->id } @maintids;
 
         if ( $ismaint && !$othermaints ) {
-            $$errref = LJ::Lang::ml( 'edges.leave.error.lastmaintainer' );
-            return 0;
+            if ( $tu->is_deleted ) {
+                # one exception: maintainer can remove themselves from a deleted community
+                return 1;
+            } else {
+                $$errref = LJ::Lang::ml( 'edges.leave.error.lastmaintainer' );
+                return 0;
+            }
         }
     }
 
diff -r f814352fdaab -r dfd44ce17c2a htdocs/community/leave.bml
--- a/htdocs/community/leave.bml	Fri Jun 12 21:11:11 2009 +0000
+++ b/htdocs/community/leave.bml	Fri Jun 12 21:13:01 2009 +0000
@@ -61,12 +61,15 @@
         $body .= " p?>";
     } else {
         # show a confirmation form
-        $body .= "<?h1 $ML{'.sure'} h1?><?p ";
+        $body .= "<?h1 $ML{'.sure'} h1?>";
+        $body .= "<p>" . BML::ml( '.label.lastmaintainer.deletedcomm' ) . "</p>" if $cu->is_deleted;
+        $body .= "<?p ";
         if ($watching && !$memberof) {
             $body .= BML::ml('.label.buttontostopwatch', { commname => $ecname });
         } else {
             $body .= BML::ml('.label.buttontoleave', { commname => $ecname });
         }
+        
         $body .= " p?>";
         $body .= '<form method="post" action="leave.bml">';
         $body .= LJ::form_auth();
diff -r f814352fdaab -r dfd44ce17c2a htdocs/community/leave.bml.text
--- a/htdocs/community/leave.bml.text	Fri Jun 12 21:11:11 2009 +0000
+++ b/htdocs/community/leave.bml.text	Fri Jun 12 21:13:01 2009 +0000
@@ -8,6 +8,8 @@
 .label.buttontostopwatch=Press the button below to stop watching the "[[commname]]" community.
 
 .label.infoerror=The specified community information is not valid.
+
+.label.lastmaintainer.deletedcomm=You are the last maintainer for this deleted community. If you leave now, it will not be possible to restore the community, should you change your mind in the future.
 
 .label.logoutfirst2=To leave a community you must first <a [[aopts]]>log in</a>.
 
--------------------------------------------------------------------------------