Skip to content

Commit

Permalink
Replace username with message for deleted users (#3945)
Browse files Browse the repository at this point in the history
  • Loading branch information
LOBsTerr committed Apr 5, 2019
1 parent 05d81f7 commit eeba535
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/Command/Database/DatabaseLogBase.php
Expand Up @@ -197,12 +197,12 @@ protected function makeQuery($offset = null, $range = 1000)
protected function createTableHeader()
{
return [
$this->trans('commands.database.log.common.messages.event-id'),
$this->trans('commands.database.log.common.messages.type'),
$this->trans('commands.database.log.common.messages.date'),
$this->trans('commands.database.log.common.messages.message'),
$this->trans('commands.database.log.common.messages.user'),
$this->trans('commands.database.log.common.messages.severity'),
$this->trans('commands.database.log.common.messages.event-id'),
$this->trans('commands.database.log.common.messages.type'),
$this->trans('commands.database.log.common.messages.date'),
$this->trans('commands.database.log.common.messages.message'),
$this->trans('commands.database.log.common.messages.user'),
$this->trans('commands.database.log.common.messages.severity'),
];
}

Expand All @@ -216,7 +216,13 @@ protected function createTableRow(\stdClass $dblog)
/**
* @var User $user
*/
$user = $this->userStorage->load($dblog->uid);
if ($user = $this->userStorage->load($dblog->uid)) {
$user_id = $user->id();
$user_name = $user->getUsername();
} else {
$user_id = $dblog->uid;
$user_name = $this->trans('commands.database.log.common.messages.user-deleted');
}

return [
$dblog->wid,
Expand All @@ -228,7 +234,7 @@ protected function createTableRow(\stdClass $dblog)
true,
true
),
$user->getUsername() . ' (' . $user->id() . ')',
$user_name . ' (' . $user_id . ')',
$this->severityList[$dblog->severity]->render(),
];
}
Expand Down

0 comments on commit eeba535

Please sign in to comment.