Commit 1040bda8 authored by lpsolit%gmail.com's avatar lpsolit%gmail.com

Bug 395924: Deleting a user account may delete other user's whine - Patch by…

Bug 395924: Deleting a user account may delete other user's whine - Patch by Fré©ric Buclin <LpSolit@gmail.com> r=wurblzap a=LpSolit
parent 68312cf9
...@@ -551,9 +551,6 @@ if ($action eq 'search') { ...@@ -551,9 +551,6 @@ if ($action eq 'search') {
} }
# 2) Whines # 2) Whines
my $sth_whineidFromSchedules = $dbh->prepare(
qq{SELECT eventid FROM whine_schedules
WHERE mailto = ? AND mailto_type = ?});
my $sth_whineidFromEvents = $dbh->prepare( my $sth_whineidFromEvents = $dbh->prepare(
'SELECT id FROM whine_events WHERE owner_userid = ?'); 'SELECT id FROM whine_events WHERE owner_userid = ?');
my $sth_deleteWhineEvent = $dbh->prepare( my $sth_deleteWhineEvent = $dbh->prepare(
...@@ -563,12 +560,8 @@ if ($action eq 'search') { ...@@ -563,12 +560,8 @@ if ($action eq 'search') {
my $sth_deleteWhineSchedule = $dbh->prepare( my $sth_deleteWhineSchedule = $dbh->prepare(
'DELETE FROM whine_schedules WHERE eventid = ?'); 'DELETE FROM whine_schedules WHERE eventid = ?');
$sth_whineidFromSchedules->execute($otherUserID, MAILTO_USER); $dbh->do('DELETE FROM whine_schedules WHERE mailto = ? AND mailto_type = ?',
while ($id = $sth_whineidFromSchedules->fetchrow_array()) { undef, ($otherUserID, MAILTO_USER));
$sth_deleteWhineQuery->execute($id);
$sth_deleteWhineSchedule->execute($id);
$sth_deleteWhineEvent->execute($id);
}
$sth_whineidFromEvents->execute($otherUserID); $sth_whineidFromEvents->execute($otherUserID);
while ($id = $sth_whineidFromEvents->fetchrow_array()) { while ($id = $sth_whineidFromEvents->fetchrow_array()) {
......
...@@ -372,27 +372,15 @@ ...@@ -372,27 +372,15 @@
will cease along with the deletion of the user account. will cease along with the deletion of the user account.
</li> </li>
[% END %] [% END %]
[% IF whine_events || whine_schedules %] [% IF whine_events %]
<li> <li>
[% otheruser.login FILTER html %] [% otheruser.login FILTER html %] has scheduled
[% IF whine_events %] [% IF whine_events == 1 %]
has scheduled a whine
[% IF whine_events == 1 %] [% ELSE %]
a whine [%+ whine_events %] whines
[% 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 %]
[% END %]. [% END %].
[% IF whine_events + whine_schedules == 1 %] [% IF whine_events == 1 %]
This whine This whine
[% ELSE %] [% ELSE %]
These whines These whines
...@@ -400,6 +388,18 @@ ...@@ -400,6 +388,18 @@
will be deleted along with the user account. will be deleted along with the user account.
</li> </li>
[% END %] [% 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> </ul>
</div> </div>
[% display_warning = 1 %] [% display_warning = 1 %]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment