afuna: Cat under a blanket. Text: "Cats are just little people with Fur and Fangs" (Default)
afuna ([personal profile] afuna) wrote in [site community profile] changelog2009-07-05 03:02 pm

[dw-free] Add optional "reason I am deleting my journal"

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

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

Can input reason when deleting; reason will be displayed on the profile page
and on the journal.

Patch by [staff profile] denise.

Files modified:
  • bin/upgrading/en.dat
  • bin/upgrading/proplists.dat
  • cgi-bin/LJ/User.pm
  • htdocs/accountstatus.bml
  • htdocs/accountstatus.bml.text
  • htdocs/userinfo.bml
--------------------------------------------------------------------------------
diff -r 49b1b53b9bea -r 56167fd880c4 bin/upgrading/en.dat
--- a/bin/upgrading/en.dat	Sun Jul 05 14:46:47 2009 +0000
+++ b/bin/upgrading/en.dat	Sun Jul 05 15:02:05 2009 +0000
@@ -1267,6 +1267,8 @@ error.deleted.name=Deleted
 error.deleted.name=Deleted
 
 error.deleted.text=This journal has been deleted.  If you are [[user]], you have a period of 30 days from the deletion time to undelete the journal.  After 30 days we will delete all content permanently from our servers.
+
+error.deleted.text.withreason=This journal has been deleted by [[user]], with a reason of: "[[reason]]".  If you are [[user]], you have a period of 30 days from the deletion time to undelete the journal.  After 30 days we will delete all content permanently from our servers.
 
 error.deleted.title=Deleted Account
 
diff -r 49b1b53b9bea -r 56167fd880c4 bin/upgrading/proplists.dat
--- a/bin/upgrading/proplists.dat	Sun Jul 05 14:46:47 2009 +0000
+++ b/bin/upgrading/proplists.dat	Sun Jul 05 15:02:05 2009 +0000
@@ -125,6 +125,14 @@ userproplist.crosspost_footer_text:
   indexed: 0
   multihomed: 0
   prettyname: Custom footer for crossposted entries
+
+userproplist.delete_reason:
+  cldversion: 4
+  datatype: char
+  des: Reason why user is deleting journal
+  indexed: 0
+  multihomed: 0
+  prettyname: The reason why you're deleting your journal
 
 userproplist.delicious:
   cldversion: 4
diff -r 49b1b53b9bea -r 56167fd880c4 cgi-bin/LJ/User.pm
--- a/cgi-bin/LJ/User.pm	Sun Jul 05 14:46:47 2009 +0000
+++ b/cgi-bin/LJ/User.pm	Sun Jul 05 15:02:05 2009 +0000
@@ -8585,7 +8585,14 @@ sub make_journal
     unless ($geta->{'viewall'} && LJ::check_priv($remote, "canview", "suspended") ||
             $opts->{'pathextra'} =~ m!/(\d+)/stylesheet$!) { # don't check style sheets
         if ( $u->is_deleted ) {
-            my $warning = BML::ml( 'error.deleted.text', { user => $u->display_name } );
+            my $warning;
+
+            if ( $u->prop( 'delete_reason' ) ) {
+                $warning = BML::ml( 'error.deleted.text.withreason', { user => $u->display_name, reason => $u->prop( 'delete_reason' ) } );
+            } else {
+                $warning = BML::ml( 'error.deleted.text', { user => $u->display_name } );
+            }
+
             return $error->( $warning, "404 Not Found", BML::ml( 'error.deleted.name' ) );
         }
         if ( $u->is_suspended ) {
diff -r 49b1b53b9bea -r 56167fd880c4 htdocs/accountstatus.bml
--- a/htdocs/accountstatus.bml	Sun Jul 05 14:46:47 2009 +0000
+++ b/htdocs/accountstatus.bml	Sun Jul 05 15:02:05 2009 +0000
@@ -64,6 +64,8 @@ body<=
         if ($POST{'statusvis'} eq 'D') {
             
             $res = $u->set_deleted;
+
+            $u->set_prop( delete_reason => $POST{'reason'} ? $POST{'reason'} : "" );
             
             if($res) {
                 # sending ESN status was changed
@@ -76,6 +78,8 @@ body<=
         } elsif ($POST{'statusvis'} eq 'V') {
             
             $res = $u->set_visible;
+
+            $u->set_prop( delete_reason => "" );
             
             if($res) {
                 LJ::Event::SecurityAttributeChanged->new($u ,  { 
@@ -153,7 +157,17 @@ body<=
     $ret .= "<div style='margin-left: 30px'>$ML{'.journalstatus.select.head'}\n";
     $ret .= LJ::html_select({ 'name' => 'statusvis', 'selected' => $u->statusvis },
                               map { $_, $statusvis{$_} }
-                              reverse sort keys %statusvis) . "\n";
+                              reverse sort keys %statusvis) . "<br /><br />\n";
+
+    $ret .= "$ML{'.reason.head'} " . LJ::html_text({ 
+                            name => 'reason', 
+                            id => 'reason', 
+                            class => 'text', 
+                            value => $u->prop( 'delete_reason' ),
+                            size => 50,
+                            maxlength => 255,
+                         }) . "<br />";
+    $ret .= "<span style='font-size:smaller; font-style:italic;'>$ML{'.reason.about'}<br /><br />\n";
 
     $ret .= LJ::html_submit(undef, $ML{'.btn.status'},
                             { 'disabled' => $u->is_suspended }) . "\n";
diff -r 49b1b53b9bea -r 56167fd880c4 htdocs/accountstatus.bml.text
--- a/htdocs/accountstatus.bml.text	Sun Jul 05 14:46:47 2009 +0000
+++ b/htdocs/accountstatus.bml.text	Sun Jul 05 15:02:05 2009 +0000
@@ -33,5 +33,9 @@
 
 .message.noothermaintainer=You are about to leave the following without an active maintainer: [[commlist]] If you want to appoint an additional maintainer now, visit the <a [[aopts]]>[[pagetitle]]</a> page.
 
+.reason.head=Reason:
+
+.reason.about=The reason you're deleting your journal, to display on your deleted journal (optional)
+
 .title=Account Status
 
diff -r 49b1b53b9bea -r 56167fd880c4 htdocs/userinfo.bml
--- a/htdocs/userinfo.bml	Sun Jul 05 14:46:47 2009 +0000
+++ b/htdocs/userinfo.bml	Sun Jul 05 15:02:05 2009 +0000
@@ -135,7 +135,15 @@ body<=
         if ( $u->is_deleted ) {
             BML::set_status(404); # 404 Not Found
             $title = $ML{'error.deleted.title'};
-            my $del_body = "<?h1 $ML{'error.deleted.name'} h1?><?p " . BML::ml( 'error.deleted.text', { user => $u->display_name } ) . " p?>";
+            my $del_body = "<?p ";
+
+            if ( $u->prop( 'delete_reason' ) ) {
+                $del_body .= BML::ml( 'error.deleted.text.withreason', { user => $u->display_name, reason => $u->prop( 'delete_reason' ) } );
+            } else {
+                $del_body .= BML::ml( 'error.deleted.text', { user => $u->display_name } );
+            }            
+
+            $del_body .= " p?>";
             $del_body .= BML::ml( '.error.deleted.purgenotification', { aopts => "href='$LJ::SITEROOT/manage/subscriptions/user.bml?journal=" . $u->user . "'" } )
                 unless LJ::User->is_protected_username( $u->user );
             return $del_body;
--------------------------------------------------------------------------------

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