Skip to content

Commit

Permalink
fix: author changed while saving existing comment
Browse files Browse the repository at this point in the history
  • Loading branch information
jackd248 committed Aug 12, 2024
1 parent 791ec6e commit 8f19268
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 72 deletions.
60 changes: 0 additions & 60 deletions Classes/Form/Element/CurrentUser.php

This file was deleted.

3 changes: 2 additions & 1 deletion Classes/Hooks/DataHandlerHook.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ public function processCmdmap_preProcess($command, $table, $id, $value, DataHand
if (!MathUtility::canBeInterpretedAsInteger($id)) {
return;
}

if ($command === 'delete' && $table === 'tx_ximatypo3contentplanner_status') {
// Clear all status of records that are assigned to the deleted status
foreach (ExtensionUtility::getRecordTables() as $table) {
Expand All @@ -54,6 +53,8 @@ public function processDatamap_beforeStart(DataHandler $dataHandler): void
$id = array_key_first($datamap['tx_ximatypo3contentplanner_comment']);
if (!MathUtility::canBeInterpretedAsInteger($id) && !array_key_exists('pages', $dataHandler->datamap)) {
$dataHandler->datamap['pages'][$datamap['tx_ximatypo3contentplanner_comment'][$id]['pid']]['tx_ximatypo3contentplanner_comments'] = $id;
// Set author to current user
$dataHandler->datamap['tx_ximatypo3contentplanner_comment'][$id]['author'] = $GLOBALS['BE_USER']->getUserId();
}
}
}
Expand Down
6 changes: 1 addition & 5 deletions Configuration/TCA/tx_ximatypo3contentplanner_comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,8 @@
],
],
'author' => [
'exclude' => 1,
'label' => 'LLL:EXT:' . Configuration::EXT_KEY . '/Resources/Private/Language/locallang_db.xlf:tx_ximatypo3contentplanner_comment.author',
'config' => [
'type' => 'user',
'readOnly' => true,
'renderType' => 'currentUser',
'type' => 'passthrough',
],
],
'foreign_table' => [
Expand Down
6 changes: 0 additions & 6 deletions ext_localconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@
'className' => \Xima\XimaTypo3ContentPlanner\Controller\TreeController::class,
];

$GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['nodeRegistry'][1719240005] = [
'nodeName' => 'currentUser',
'priority' => 40,
'class' => \Xima\XimaTypo3ContentPlanner\Form\Element\CurrentUser::class,
];

$GLOBALS['TYPO3_CONF_VARS']['BE']['toolbarItems'][1719820170] = \Xima\XimaTypo3ContentPlanner\Backend\ToolbarItems\UpdateItem::class;

$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['ximatypo3contentplanner_toolbarcache'] ??= [];
Expand Down

0 comments on commit 8f19268

Please sign in to comment.