From ca9a307193a74201b595deec239c68f690209fb7 Mon Sep 17 00:00:00 2001
From: Christian Kuhn <lolli@schwarzbu.ch>
Date: Tue, 10 Jan 2023 15:43:12 +0100
Subject: [PATCH] [TASK] Remove obsolete hack in TsConfigTreeBuilder
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

UserTs building has a hack for sys_note setting
TCAdefaults.sys_note.author and
TCAdefaults.sys_note.email.

These two fields have been removed from table sys_note
in 6.0, the options are useless and can be removed:
The creating user uid is stored in field 'cruser',
resolving to human readable names is done when rendering
notes.

Change-Id: I562678a516c7fc8284f82a1123035ce06bd7a188
Resolves: #99507
Related: #97816
Releaeses: main
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/77319
Reviewed-by: Stefan Bürk <stefan@buerk.tech>
Tested-by: Stefan Bürk <stefan@buerk.tech>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: core-ci <typo3@b13.com>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
---
 .../Classes/TypoScript/IncludeTree/TsConfigTreeBuilder.php   | 5 -----
 .../Authentication/BackendUserAuthenticationTest.php         | 2 --
 2 files changed, 7 deletions(-)

diff --git a/typo3/sysext/core/Classes/TypoScript/IncludeTree/TsConfigTreeBuilder.php b/typo3/sysext/core/Classes/TypoScript/IncludeTree/TsConfigTreeBuilder.php
index ce29215b2a31..54e734e90d1f 100644
--- a/typo3/sysext/core/Classes/TypoScript/IncludeTree/TsConfigTreeBuilder.php
+++ b/typo3/sysext/core/Classes/TypoScript/IncludeTree/TsConfigTreeBuilder.php
@@ -63,11 +63,6 @@ final class TsConfigTreeBuilder
             // @todo: Could we maybe solve this differently somehow? Maybe in ext:adminpanel in FE directly?
             $includeTree->addChild($this->getTreeFromString('userTsConfig-admpanel', 'admPanel.enable.all = 1'));
         }
-        // @todo: Get rid of this, maybe by using a hook in DataHandler?
-        $includeTree->addChild($this->getTreeFromString(
-            'userTsConfig-sysnote',
-            'TCAdefaults.sys_note.author = ' . ($backendUser->user['realName'] ?? '') . chr(10) . 'TCAdefaults.sys_note.email = ' . ($backendUser->user['email'] ?? '')
-        ));
         foreach ($backendUser->userGroupsUID as $groupId) {
             // Loop through all groups and add their 'TSconfig' fields
             if (!empty($backendUser->userGroups[$groupId]['TSconfig'] ?? '')) {
diff --git a/typo3/sysext/core/Tests/Functional/Authentication/BackendUserAuthenticationTest.php b/typo3/sysext/core/Tests/Functional/Authentication/BackendUserAuthenticationTest.php
index 539c6fd845dd..fd113406b659 100644
--- a/typo3/sysext/core/Tests/Functional/Authentication/BackendUserAuthenticationTest.php
+++ b/typo3/sysext/core/Tests/Functional/Authentication/BackendUserAuthenticationTest.php
@@ -74,13 +74,11 @@ class BackendUserAuthenticationTest extends FunctionalTestCase
     public function userTsConfigIsResolvedProperlyWithPrioritization(): void
     {
         $GLOBALS['TYPO3_CONF_VARS']['BE']['defaultUserTSconfig'] = "custom.generic = installation-wide-configuration\ncustom.property = from configuration";
-        $this->subject->user['realName'] = 'Test user';
         $this->subject->user['TSconfig'] = 'custom.property = from user';
         $this->subject->userGroupsUID[] = 13;
         $this->subject->userGroups[13]['TSconfig'] = "custom.property = from group\ncustom.groupProperty = 13";
         $this->subject->fetchGroupData();
         $result = $this->subject->getTSConfig();
-        self::assertEquals($this->subject->user['realName'], $result['TCAdefaults.']['sys_note.']['author']);
         self::assertEquals('from user', $result['custom.']['property']);
         self::assertEquals('13', $result['custom.']['groupProperty']);
         self::assertEquals('installation-wide-configuration', $result['custom.']['generic']);
-- 
GitLab