From 5107efb51fdeac3b9167d010141cd4bb5482c10a Mon Sep 17 00:00:00 2001 From: "wurblzap%gmail.com" <> Date: Wed, 14 Dec 2005 04:20:12 +0000 Subject: Bug 319942: Preferences not deleted along with user accounts. Patch by Marc Schumann , r=LpSolit, a=justdave --- editusers.cgi | 12 ++++++++++++ .../en/default/admin/users/confirm-delete.html.tmpl | 18 +++++++++++++++--- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/editusers.cgi b/editusers.cgi index e9b61b13d..bfc7eee14 100755 --- a/editusers.cgi +++ b/editusers.cgi @@ -436,6 +436,9 @@ if ($action eq 'search') { $vars->{'bugs_activity'} = $dbh->selectrow_array( 'SELECT COUNT(*) FROM bugs_activity WHERE who = ?', undef, $otherUserID); + $vars->{'email_setting'} = $dbh->selectrow_array( + 'SELECT COUNT(*) FROM email_setting WHERE user_id = ?', + undef, $otherUserID); $vars->{'flags'}{'requestee'} = $dbh->selectrow_array( 'SELECT COUNT(*) FROM flags WHERE requestee_id = ? AND is_active = 1', undef, $otherUserID); @@ -448,6 +451,9 @@ if ($action eq 'search') { $vars->{'namedqueries'} = $dbh->selectrow_array( 'SELECT COUNT(*) FROM namedqueries WHERE userid = ?', undef, $otherUserID); + $vars->{'profile_setting'} = $dbh->selectrow_array( + 'SELECT COUNT(*) FROM profile_setting WHERE user_id = ?', + undef, $otherUserID); $vars->{'profiles_activity'} = $dbh->selectrow_array( 'SELECT COUNT(*) FROM profiles_activity WHERE who = ? AND userid != ?', undef, ($otherUserID, $otherUserID)); @@ -499,6 +505,8 @@ if ($action eq 'search') { 'logincookies WRITE', 'profiles WRITE', 'profiles_activity WRITE', + 'email_setting WRITE', + 'profile_setting WRITE', 'groups READ', 'bug_group_map READ', 'user_group_map WRITE', @@ -568,8 +576,12 @@ if ($action eq 'search') { } # Simple deletions in referred tables. + $dbh->do('DELETE FROM email_setting WHERE user_id = ?', undef, + $otherUserID); $dbh->do('DELETE FROM logincookies WHERE userid = ?', undef, $otherUserID); $dbh->do('DELETE FROM namedqueries WHERE userid = ?', undef, $otherUserID); + $dbh->do('DELETE FROM profile_setting WHERE user_id = ?', undef, + $otherUserID); $dbh->do('DELETE FROM profiles_activity WHERE userid = ? OR who = ?', undef, ($otherUserID, $otherUserID)); $dbh->do('DELETE FROM tokens WHERE userid = ?', undef, $otherUserID); diff --git a/template/en/default/admin/users/confirm-delete.html.tmpl b/template/en/default/admin/users/confirm-delete.html.tmpl index afe464697..71e2068ad 100644 --- a/template/en/default/admin/users/confirm-delete.html.tmpl +++ b/template/en/default/admin/users/confirm-delete.html.tmpl @@ -235,9 +235,9 @@ [% display_warning = 1 %] [% END %] - [% IF assignee_or_qa || cc || flags.requestee || namedqueries || - series || votes || watch.watched || watch.watcher || - whine_events || whine_schedules %] + [% IF assignee_or_qa || cc || email_setting || flags.requestee || + namedqueries || profile_setting || series || votes || watch.watched || + watch.watcher || whine_events || whine_schedules %]

The following deletions are safe and will not generate referential integrity inconsistencies.

@@ -272,6 +272,12 @@ If you delete the user account, it will be removed from these CC lists. [% END %] + [% IF email_setting %] +
  • + The user's e-mail settings will be deleted along with the user + account. +
  • + [% END %] [% IF flags.requestee %]
  • [% otheruser.login FILTER html %] has been @@ -308,6 +314,12 @@ will be deleted along with the user account.
  • [% END %] + [% IF profile_setting %] +
  • + The user's preference settings will be deleted along with the user + account. +
  • + [% END %] [% IF series %]
  • [% otheruser.login FILTER html %] has created -- cgit v1.2.3-24-g4f1b