Skip to content

Commit

Permalink
Merge pull request #2 from teamneusta/v11_compatibility
Browse files Browse the repository at this point in the history
[TASK] update extension for TYPO3 v11 compatibility
  • Loading branch information
d3pendent authored Aug 8, 2022
2 parents f5dae93 + e05dc47 commit dbda275
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 58 deletions.
20 changes: 13 additions & 7 deletions Classes/Controller/BackendModerateCommentsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,17 @@
use Neusta\Modmod\Provider\PagetreeProvider;
use Neusta\Modmod\Utility\BackendUserUtility;
use Neusta\Modmod\Utility\PagetreeUtility;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Backend\Routing\UriBuilder as BackendUriBuilder;
use TYPO3\CMS\Core\Http\ServerRequestFactory;
use TYPO3\CMS\Extbase\Http\ForwardResponse;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;

class BackendModerateCommentsController extends ActionController
{
const CMD_PUBLISH = 'publish';
const CMD_UNPUBLISH = 'unpublish';
public const CMD_PUBLISH = 'publish';
public const CMD_UNPUBLISH = 'unpublish';

private BackendUriBuilder $beUriBuilder;

Expand All @@ -38,7 +40,7 @@ public function __construct(
$this->formValueProvider = $formValueProvider;
}

public function indexAction(): void
public function indexAction(): ResponseInterface
{
$pageId = $this->getCurrentPageId();
$depth = (int)$this->formValueProvider->getStoredValue($this->request->getPluginName(), 'depth');
Expand All @@ -64,9 +66,11 @@ public function indexAction(): void
'tree' => $pageTree,
'comments' => $this->commentRepository->findByPageIds($uidList),
]);

return $this->htmlResponse();
}

public function toggleVisibilityAction(): void
public function toggleVisibilityAction(): ResponseInterface
{
$commentUid = (int)($this->request->getArgument('comment') ?? 0);
$action = $this->request->getArgument('command') ?? '';
Expand All @@ -80,16 +84,18 @@ public function toggleVisibilityAction(): void
default:
break;
}
$this->forward('index');

return new ForwardResponse('index');
}

public function deleteAction(): void
public function deleteAction(): ResponseInterface
{
$commentUid = (int)($this->request->getArgument('comment') ?? 0);
if ($commentUid > 0) {
$this->commentRepository->deleteComment($commentUid);
}
$this->forward('index');

return new ForwardResponse('index');
}

protected function getCurrentPageId(): int
Expand Down
8 changes: 8 additions & 0 deletions Configuration/Icons.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

return [
'tx-modmod-widgets' => [
'provider' => \TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider::class,
'source' => 'EXT:modmod/Resources/Public/Icons/module-modmod.svg',
],
];
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ You can specify the displayed levels of the page tree, starting with the selecte

The dashboard widget will show the latest 15 unmoderated (hidden) comments across all pages.

install via composer `composer req neusta/modmod`
install via composer `composer req teamneusta/modmod`

11 changes: 8 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,18 @@
"name": "team neusta GmbH",
"role": "Developer",
"homepage": "https://team-neusta.de/"
},
{
"name": "Tobias Kretschmann",
"role": "Developer",
"email": "[email protected]"
}
],
"version": "1.0.4",
"version": "2.0.0",
"require": {
"php": "~7.4",
"typo3/cms-core": ">=10.4.0 <=10.4.99",
"t3/pw_comments": ">=5.1.0 <=5.1.99"
"typo3/cms-core": "^11.5",
"t3/pw_comments": "^5.2"
},
"require-dev": {
"roave/security-advisories": "dev-latest"
Expand Down
31 changes: 0 additions & 31 deletions ext_emconf.php

This file was deleted.

14 changes: 0 additions & 14 deletions ext_localconf.php

This file was deleted.

8 changes: 6 additions & 2 deletions ext_tables.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
<?php

use Neusta\Modmod\Controller\BackendModerateCommentsController;
use TYPO3\CMS\Extbase\Utility\ExtensionUtility;

if (!defined('TYPO3')) {
die('Access denied.');
}

(static function (string $extKey): void {
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule(
ExtensionUtility::registerModule(
$extKey,
'web',
'Moderate',
'after:info',
[
\Neusta\Modmod\Controller\BackendModerateCommentsController::class => 'index, toggleVisibility, delete',
BackendModerateCommentsController::class => 'index, toggleVisibility, delete',
],
[
'access' => 'user',
Expand Down

0 comments on commit dbda275

Please sign in to comment.