madeon (madeon) wrote in changelog,
madeon
madeon
changelog

[livejournal] r22170: LJSUP-12425: Log mass deletion of inbox ...

Committer: sbelyaev
LJSUP-12425: Log mass deletion of inbox messages to userlog
U   trunk/cgi-bin/LJ/NotificationInbox.pm
U   trunk/htdocs/admin/userlog.bml
U   trunk/htdocs/inbox/index.bml
U   trunk/htdocs/tools/endpoints/esn_inbox.bml
Modified: trunk/cgi-bin/LJ/NotificationInbox.pm
===================================================================
--- trunk/cgi-bin/LJ/NotificationInbox.pm	2012-06-05 10:39:17 UTC (rev 22169)
+++ trunk/cgi-bin/LJ/NotificationInbox.pm	2012-06-05 11:11:10 UTC (rev 22170)
@@ -598,6 +598,16 @@
         push @ret, {qid => $item->qid};
     }
 
+    my $u = $self->u;
+    my $interface = $opts{'interface'};
+
+    $u->log_event('inbox_massdel', {
+                         remote => $u,
+                         actiontarget => scalar @items,
+                         method => 'delete_all',
+                         view   => $view,  
+                         via    => $interface, });
+
     # Delete items
     foreach my $item (@items) {
         if ($opts{spam}) {

Modified: trunk/htdocs/admin/userlog.bml
===================================================================
--- trunk/htdocs/admin/userlog.bml	2012-06-05 10:39:17 UTC (rev 22169)
+++ trunk/htdocs/admin/userlog.bml	2012-06-05 11:11:10 UTC (rev 22170)
@@ -105,6 +105,9 @@
         } elsif ($row->{action} eq 'ban_unset') {
             my $u = LJ::load_userid($row->{actiontarget});
             $action = "Unbanned " . LJ::ljuser($u) if $u;
+        } elsif ($row->{action} eq 'inbox_massdel') {
+             $action = "User delete lots of messages ($row->{actiontarget} messages deleted)" .
+                       " via '$extra->{via}' for '$extra->{view}' view";
         } elsif ($row->{action} eq 'friend_invite_sent') {
             $action = "Friend invite sent to $extra->{extra}";
         } elsif ($row->{action} eq 'maintainer_add') {

Modified: trunk/htdocs/inbox/index.bml
===================================================================
--- trunk/htdocs/inbox/index.bml	2012-06-05 10:39:17 UTC (rev 22169)
+++ trunk/htdocs/inbox/index.bml	2012-06-05 11:11:10 UTC (rev 22170)
@@ -93,7 +93,7 @@
         if ($POST{markAllRead}) {
             $inbox->mark_all_read( $view );
         } elsif ($POST{deleteAll}) {
-            $inbox->delete_all( $view );
+            $inbox->delete_all( $view,  interface => 'web' );
         } else {
             # go through each item and see if it's checked
             foreach my $item (@$nitems) {
@@ -110,6 +110,15 @@
                 }
             }
 
+            if ($POST{delete} && scalar @$nitems > 15) {
+                $remote->log_event('inbox_massdel', {
+                                         remote => $remote,
+                                         actiontarget => scalar @$nitems,
+                                         method => 'delete',
+                                         view   => $view,
+                                         via    => 'web', });
+            }
+
             # reload inbox after making changes
             @$nitems = eval "\$inbox->${name}_items";
         }

Modified: trunk/htdocs/tools/endpoints/esn_inbox.bml
===================================================================
--- trunk/htdocs/tools/endpoints/esn_inbox.bml	2012-06-05 10:39:17 UTC (rev 22169)
+++ trunk/htdocs/tools/endpoints/esn_inbox.bml	2012-06-05 11:11:10 UTC (rev 22170)
@@ -73,9 +73,19 @@
             }
         }
 
+        if (scalar @items >= 1) {
+            $remote->log_event('inbox_massdel', {
+                                     remote => $remote,
+                                     actiontarget => scalar @items,
+                                     method => 'delete',
+                                     view   => $cur_folder,
+                                     via    => 'web', });
+        }
+
         $success = 1;
     } elsif ($action eq 'delete_all') {
-        @items = $inbox->delete_all( $cur_folder, { spam => $POST{spam} } );
+        @items = $inbox->delete_all( $cur_folder, interface => 'web',
+                                                  spam => $POST{spam}  );
 
         foreach my $item (@items) {
             push @{$ret{items}}, { qid => $item->{qid}, deleted => 1 };

Tags: bml, livejournal, madeon, pm, sbelyaev
Subscribe

  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments