]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 395924: Deleting a user account may delete other user's whine - Patch by FrÃ...
authorlpsolit%gmail.com <>
Mon, 19 Nov 2007 18:45:31 +0000 (18:45 +0000)
committerlpsolit%gmail.com <>
Mon, 19 Nov 2007 18:45:31 +0000 (18:45 +0000)
editusers.cgi
template/en/default/admin/users/confirm-delete.html.tmpl

index b4e3f698eb62ff1c295db8896a328a990bbe2ef9..0aca20d52fa237aecba56687b48c5b8ce496e99d 100755 (executable)
@@ -585,9 +585,6 @@ if ($action eq 'search') {
     }
 
     # 2) Whines
-    my $sth_whineidFromSchedules = $dbh->prepare(
-           qq{SELECT eventid FROM whine_schedules
-              WHERE mailto = ? AND mailto_type = ?});
     my $sth_whineidFromEvents = $dbh->prepare(
            'SELECT id FROM whine_events WHERE owner_userid = ?');
     my $sth_deleteWhineEvent = $dbh->prepare(
@@ -597,12 +594,8 @@ if ($action eq 'search') {
     my $sth_deleteWhineSchedule = $dbh->prepare(
            'DELETE FROM whine_schedules WHERE eventid = ?');
 
-    $sth_whineidFromSchedules->execute($otherUserID, MAILTO_USER);
-    while ($id = $sth_whineidFromSchedules->fetchrow_array()) {
-        $sth_deleteWhineQuery->execute($id);
-        $sth_deleteWhineSchedule->execute($id);
-        $sth_deleteWhineEvent->execute($id);
-    }
+    $dbh->do('DELETE FROM whine_schedules WHERE mailto = ? AND mailto_type = ?',
+             undef, ($otherUserID, MAILTO_USER));
 
     $sth_whineidFromEvents->execute($otherUserID);
     while ($id = $sth_whineidFromEvents->fetchrow_array()) {
index ef986fd9a809e5bd3907cd9220b50262f1213a73..aa3d6da177584061fe48d90a3351c200c2aec0d1 100644 (file)
             will cease along with the deletion of the user account.
           </li>
         [% END %]
-        [% IF whine_events || whine_schedules %]
+        [% IF whine_events %]
           <li>
-            [% otheruser.login FILTER html %]
-            [% IF whine_events %]
-              has scheduled
-              [% IF whine_events == 1 %]
-                a whine
-              [% ELSE %]
-                [%+ whine_events %] whines
-              [% END %]
-            [% END %]
-            [% IF whine_schedules %]
-              [%+ 'and' IF whine_events %]
-              is on the receiving end of
-              [% IF whine_schedules == 1 %]
-                a whine
-              [% ELSE %]
-                [%+ whine_schedules %] whines
-              [% END %]
+            [% otheruser.login FILTER html %] has scheduled
+            [% IF whine_events == 1 %]
+              a whine
+            [% ELSE %]
+              [%+ whine_events %] whines
             [% END %].
-            [% IF whine_events + whine_schedules == 1 %]
+            [% IF whine_events == 1 %]
               This whine
             [% ELSE %]
               These whines
             will be deleted along with the user account.
           </li>
         [% END %]
+        [% IF whine_schedules %]
+          <li>
+            [% otheruser.login FILTER html %] is on the receiving end of
+            [% IF whine_schedules == 1 %]
+              a whine
+            [% ELSE %]
+              [%+ whine_schedules %] whines
+            [% END %].
+            The corresponding schedules will be deleted along with the user account,
+            but the whines themselves will be left unaltered.
+          </li>
+        [% END %]
       </ul>
     </div>
     [% display_warning = 1 %]