summaryrefslogtreecommitdiffstats
path: root/editusers.cgi
diff options
context:
space:
mode:
Diffstat (limited to 'editusers.cgi')
-rwxr-xr-xeditusers.cgi66
1 files changed, 53 insertions, 13 deletions
diff --git a/editusers.cgi b/editusers.cgi
index b6f5a6c52..e153cfbbc 100755
--- a/editusers.cgi
+++ b/editusers.cgi
@@ -672,20 +672,60 @@ if ($action eq 'search') {
($activity_userid, $activity_who) = ($activity_who, $activity_userid);
}
- $vars->{'profile_changes'} = $dbh->selectall_arrayref(
- "SELECT profiles.login_name AS who, " .
- $dbh->sql_date_format('profiles_activity.profiles_when') . " AS activity_when,
- fielddefs.name AS what,
- profiles_activity.oldvalue AS removed,
- profiles_activity.newvalue AS added
- FROM profiles_activity
- INNER JOIN profiles ON $activity_who = profiles.userid
- INNER JOIN fielddefs ON fielddefs.id = profiles_activity.fieldid
- WHERE $activity_userid = ?
- ORDER BY profiles_activity.profiles_when",
- {'Slice' => {}},
- $otherUser->id);
+ my $sql = "
+ SELECT
+ profiles.login_name AS who,
+ " . $dbh->sql_date_format('profiles_activity.profiles_when') . " AS activity_when,
+ fielddefs.name AS what,
+ profiles_activity.oldvalue AS removed,
+ profiles_activity.newvalue AS added
+ FROM
+ profiles_activity
+ INNER JOIN profiles ON $activity_who = profiles.userid
+ INNER JOIN fielddefs ON fielddefs.id = profiles_activity.fieldid
+ WHERE
+ $activity_userid = ?
+ ";
+ my @values = ($otherUser->id);
+
+ if ($action ne 'admin_activity') {
+ $sql .= "
+ UNION ALL
+
+ SELECT
+ COALESCE(profiles.login_name, '-') AS who,
+ " . $dbh->sql_date_format('audit_log.at_time') . " AS activity_when,
+ field AS what,
+ removed,
+ added
+ FROM
+ audit_log
+ LEFT JOIN profiles ON profiles.userid = audit_log.user_id
+ WHERE
+ audit_log.object_id = ?
+ AND audit_log.class = 'Bugzilla::User'
+ AND audit_log.field != 'last_activity_ts'
+ ";
+ push @values, $otherUser->id;
+ }
+
+ $sql .= " ORDER BY activity_when";
+
+ # massage some fields to improve readability
+ my $profile_changes = $dbh->selectall_arrayref($sql, { Slice => {} }, @values);
+ foreach my $change (@$profile_changes) {
+ if ($change->{what} eq 'cryptpassword') {
+ $change->{what} = 'password';
+ $change->{removed} = '';
+ $change->{added} = '(updated)';
+ }
+ elsif ($change->{what} eq 'public_key') {
+ $change->{removed} = '(updated)' if $change->{removed} ne '';
+ $change->{added} = '(updated)' if $change->{added} ne '';
+ }
+ }
+ $vars->{'profile_changes'} = $profile_changes;
$vars->{'otheruser'} = $otherUser;
$vars->{'action'} = $action;