Skip to content

Commit

Permalink
[TASK] Show user real name in ElementHistoryController
Browse files Browse the repository at this point in the history
This patch improves the record history view of an element
by showing the realName on top of the username if available.

Resolves: #102091
Releases: main, 12.4
Change-Id: I14387e6113ea632615cddd537136660d310819a9
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/81332
Tested-by: core-ci <typo3@b13.com>
Reviewed-by: Stefan Bürk <stefan@buerk.tech>
Tested-by: Stefan Bürk <stefan@buerk.tech>
  • Loading branch information
josefglatz authored and sbuerk committed Oct 5, 2023
1 parent 8f9a53c commit ec462b5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Expand Up @@ -269,7 +269,7 @@ protected function displayHistory(array $historyEntries)
}
$languageService = $this->getLanguageService();
$lines = [];
$beUserArray = BackendUtility::getUserNames();
$beUserArray = BackendUtility::getUserNames('username,realName,usergroup,uid');

// Traverse changeLog array:
foreach ($historyEntries as $entry) {
Expand All @@ -279,10 +279,12 @@ protected function displayHistory(array $historyEntries)
// Get user names
$singleLine['backendUserUid'] = $entry['userid'];
$singleLine['backendUserName'] = $beUserArray[$entry['userid']]['username'] ?? '';
$singleLine['backendUserRealName'] = $beUserArray[$entry['userid']]['realName'] ?? '';
// Executed by switch user
if (!empty($entry['originaluserid'])) {
$singleLine['originalBackendUserUid'] = $entry['originaluserid'];
$singleLine['originalBackendUserName'] = $beUserArray[$entry['originaluserid']]['username'] ?? '';
$singleLine['originalBackendRealName'] = $beUserArray[$entry['originaluserid']]['realName'] ?? '';
}

// Is a change in a workspace?
Expand Down
Expand Up @@ -47,7 +47,15 @@ <h2>{f:translate(key: 'LLL:EXT:backend/Resources/Private/Language/locallang_show
<be:avatar backendUser="{historyRow.backendUserUid}"/>
<f:if condition="{historyRow.backendUserUid}">
<f:then>
{f:if(condition: historyRow.backendUserName, then: historyRow.backendUserName, else: '{f:translate(key: \'LLL:EXT:backend/Resources/Private/Language/locallang_show_rechis.xlf:userNotFound\')}')}
<f:if condition="{historyRow.backendUserRealName}">
<f:then>
{historyRow.backendUserRealName}
<span class="text-muted d-block">({f:if(condition: historyRow.backendUserName, then: historyRow.backendUserName, else: '{f:translate(key: \'LLL:EXT:backend/Resources/Private/Language/locallang_show_rechis.xlf:userNotFound\')}')})</span>
</f:then>
<f:else>
{f:if(condition: historyRow.backendUserName, then: historyRow.backendUserName, else: '{f:translate(key: \'LLL:EXT:backend/Resources/Private/Language/locallang_show_rechis.xlf:userNotFound\')}')}
</f:else>
</f:if>
</f:then>
<f:else>
{f:translate(key: 'LLL:EXT:backend/Resources/Private/Language/locallang_show_rechis.xlf:externalChange')}
Expand Down

0 comments on commit ec462b5

Please sign in to comment.