kareila: (Default)
kareila ([personal profile] kareila) wrote in [site community profile] changelog2010-04-02 10:34 pm

[dw-free] One-click tool to delete all inactive subscriptions

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

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

Add a button for deleting all inactive subscriptions from the notification
management page.

Patch by [personal profile] yvi.

Files modified:
  • htdocs/manage/settings/index.bml
  • htdocs/manage/settings/index.bml.text
--------------------------------------------------------------------------------
diff -r 9988329bc67f -r 8a698e734a78 htdocs/manage/settings/index.bml
--- a/htdocs/manage/settings/index.bml	Fri Apr 02 11:27:37 2010 -0500
+++ b/htdocs/manage/settings/index.bml	Fri Apr 02 17:33:58 2010 -0500
@@ -200,7 +200,10 @@ body<=
         return LJ::bad_input($ML{'error.invalidform'})
             unless LJ::check_form_auth();
 
-        if ($given_cat eq "notifications") {
+        if ( $given_cat eq "notifications" && $POST{deleteinactive} ) {
+            $u->delete_all_inactive_subscriptions;
+            $submit_msg .= "<?errorbar $ML{'.success.deleteinactive'} errorbar?><br />";
+        } elsif ( $given_cat eq "notifications" ) {
             my @notif_errors;
 
             # do they want to add or edit subscriptions?
@@ -419,6 +422,13 @@ body<=
 
     $ret .= "<div id='settings_save'>";
     $ret .= $cats_with_settings{$given_cat}->{form} ? LJ::html_submit($ML{'.btn.save'}) : "&nbsp;";
+    $ret .= "&nbsp;";
+    my $del_conf = LJ::ejs( $ML{'.confirm.deleteinactive'} );
+    $ret .= LJ::html_submit( 'deleteinactive', $ML{'.btn.deleteinactive'}, {
+        class => 'btn',
+        title => $ML{'.btn.deleteinactive'},
+        onClick => "return confirm( '$del_conf' )"
+        } );
     $ret .= "</div>";
 
         my $my_account_extra = LJ::Hooks::run_hook('subscriptions_manage_my_account_extra', $u);
@@ -545,6 +555,15 @@ body<=
 
     $ret .= "<div id='settings_save'>";
     $ret .= $cats_with_settings{$given_cat}->{form} ? LJ::html_submit($ML{'.btn.save'}) : "&nbsp;";
+    if ( $given_cat eq "notifications" ) {
+        $ret .= "&nbsp;";
+        my $del_conf = LJ::ejs( $ML{'.confirm.deleteinactive'} );
+        $ret .= LJ::html_submit( 'deleteinactive', $ML{'.btn.deleteinactive'}, {
+            class => 'btn',
+            title => $ML{'.btn.deleteinactive'},
+            onClick => "return confirm( '$del_conf' )"
+            } );
+    }
     $ret .= "</div>";
     $ret .= "</form>" if $cats_with_settings{$given_cat}->{form};
 
diff -r 9988329bc67f -r 8a698e734a78 htdocs/manage/settings/index.bml.text
--- a/htdocs/manage/settings/index.bml.text	Fri Apr 02 11:27:37 2010 -0500
+++ b/htdocs/manage/settings/index.bml.text	Fri Apr 02 17:33:58 2010 -0500
@@ -17,6 +17,8 @@
 .bdayreminder.note=Note: This feature is currently disabled, but may be re-enabled in the future.
 
 .btn.save=Save
+
+.btn.deleteinactive=Delete all inactive subscriptions
 
 .cat.account=Account
 
@@ -49,6 +51,8 @@
 .commentpage=View comment pages in your own journal style
 
 .commentpage.text=When you follow a comment link from your Friends page, you can view that comment page in your own journal style.
+
+.confirm.deleteinactive=Are you sure you want to delete all inactive subscriptions?
 
 .contextualhover=Show contextual hover menu
 
@@ -167,6 +171,8 @@ in any form or by any means for commerci
 
 .success=You have successfully saved your account settings.
 
+.success.deleteinactive=You have successfully deleted all inactive subscriptions.
+
 .success.header=Success!
 
 .success.text=Your viewing options have been updated.
--------------------------------------------------------------------------------