diff options
-rwxr-xr-x | editusers.cgi | 66 | ||||
-rw-r--r-- | template/en/default/admin/table.html.tmpl | 2 |
2 files changed, 54 insertions, 14 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; diff --git a/template/en/default/admin/table.html.tmpl b/template/en/default/admin/table.html.tmpl index 40c66f109..69fae3dac 100644 --- a/template/en/default/admin/table.html.tmpl +++ b/template/en/default/admin/table.html.tmpl @@ -154,7 +154,7 @@ <a href="[% link_uri %]"> [% END %] - [% IF content_use_field %] + [% IF content_use_field && field_descs.exists(row.${c.name}) %] [% colname = row.${c.name} %] [% field_descs.${colname} FILTER html %] [% ELSIF content %] |