From: lpsolit%gmail.com <> Date: Mon, 19 Nov 2007 18:45:31 +0000 (+0000) Subject: Bug 395924: Deleting a user account may delete other user's whine - Patch by FrÃ... X-Git-Tag: bugzilla-3.0.3~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ace8a16064fb880a9a3912bc7471f077a08c9802;p=thirdparty%2Fbugzilla.git Bug 395924: Deleting a user account may delete other user's whine - Patch by Frédéric Buclin r=wurblzap a=LpSolit --- diff --git a/editusers.cgi b/editusers.cgi index b4e3f698eb..0aca20d52f 100755 --- a/editusers.cgi +++ b/editusers.cgi @@ -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()) { diff --git a/template/en/default/admin/users/confirm-delete.html.tmpl b/template/en/default/admin/users/confirm-delete.html.tmpl index ef986fd9a8..aa3d6da177 100644 --- a/template/en/default/admin/users/confirm-delete.html.tmpl +++ b/template/en/default/admin/users/confirm-delete.html.tmpl @@ -401,27 +401,15 @@ will cease along with the deletion of the user account. [% END %] - [% IF whine_events || whine_schedules %] + [% IF whine_events %]
  • - [% 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 @@ -429,6 +417,18 @@ will be deleted along with the user account.
  • [% END %] + [% IF whine_schedules %] +
  • + [% 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. +
  • + [% END %] [% display_warning = 1 %]