Skip to content

Commit

Permalink
Merge pull request #6 from nitsan-technologies/feature/stability-master
Browse files Browse the repository at this point in the history
Feature/stability master
  • Loading branch information
nitsan-technologies authored Aug 30, 2024
2 parents a0d6b8a + eb68e1f commit 0a79a32
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 49 deletions.
2 changes: 1 addition & 1 deletion Classes/Controller/CommentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public function listAction(): ResponseInterface
// @extensionScannerIgnoreLine
$pid = $GLOBALS['TSFE']->id;
if ($pid) {
$comments = $this->commentRepository->getCommentsByPage($pid, $setting['commnetlanguageFallbackMode'])->toArray();
$comments = $this->commentRepository->getCommentsByPage($pid)->toArray();
$paths = $this->captchaVerificationPath();

$captcha_path = $paths['captcha'] . '?' . rand();
Expand Down
19 changes: 3 additions & 16 deletions Classes/Domain/Repository/CommentRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/

use TYPO3\CMS\Core\Context\Context;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Persistence\QueryInterface;
use TYPO3\CMS\Extbase\Persistence\QueryResultInterface;
use TYPO3\CMS\Extbase\Persistence\Repository;
Expand All @@ -43,28 +41,17 @@ class CommentRepository extends Repository
* @param $mode
* @return array|object[]|QueryResultInterface
*/
public function getCommentsByPage($pageId, $mode): QueryResultInterface|array
public function getCommentsByPage($pageId): QueryResultInterface|array
{
$context = GeneralUtility::makeInstance(Context::class);
$languageId = $context->getPropertyFromAspect('language', 'id');
$query = $this->createQuery();
if ($mode > 0) {
$query->getQuerySettings()->setRespectSysLanguage(false);
$query->matching(
$query->logicalAnd(
$query->equals('pageuid', $pageId),
$query->equals('comment', 0),
$query->equals('sys_language_uid', $languageId)
)
);
} else {

$query->matching(
$query->logicalAnd(
$query->equals('pageuid', $pageId),
$query->equals('comment', 0)
)
);
}

$query->setOrderings(['crdate' => QueryInterface::ORDER_DESCENDING]);
$query->getQuerySettings()->setRespectStoragePage(false);
return $query->execute();
Expand Down
19 changes: 0 additions & 19 deletions Configuration/FlexForm/FlexForm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,6 @@
</TCEforms>
<type>array</type>
<el>
<settings.commnetlanguageFallbackMode>
<TCEforms>
<label>LLL:EXT:ns_comments/Resources/Private/Language/locallang_db.xlf:flexform.languageFallbackMode</label>
<config>
<type>radio</type>
<items>
<numIndex index="0">
<numIndex index="0">LLL:EXT:ns_comments/Resources/Private/Language/locallang_db.xlf:flexform.languageFallbackMode.strict</numIndex>
<numIndex index="1">0</numIndex>
</numIndex>
<numIndex index="1">
<numIndex index="0">LLL:EXT:ns_comments/Resources/Private/Language/locallang_db.xlf:flexform.languageFallbackMode.translated</numIndex>
<numIndex index="1">1</numIndex>
</numIndex>
</items>
<default>0</default>
</config>
</TCEforms>
</settings.commnetlanguageFallbackMode>
<settings.custom>
<TCEforms>
<label>LLL:EXT:ns_comments/Resources/Private/Language/locallang_db.xlf:flexform.custom</label>
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Pages Comment

[![PagesComment](https://img.shields.io/badge/stable-v12.1.1-green?style=flat-square)](https://github.com/nitsan-technologies/ns_comments/tree/12.1.1) [![TYPO3 12](https://img.shields.io/badge/TYPO3-12-orange.svg?style=flat-square)](https://get.typo3.org/version/12) [![License](https://img.shields.io/badge/license-GPL--3.0-orange?style=flat-square)](https://www.gnu.org/licenses/gpl-3.0.en.html) [![T3Planet](https://img.shields.io/badge/T3Planet-PagesComment-50b99a?style=flat-square)](https://t3planet.com/typo3-page-comment-extension)
[![PagesComment](https://img.shields.io/badge/stable-v12.1.2-green?style=flat-square)](https://github.com/nitsan-technologies/ns_comments/tree/12.1.2) [![TYPO3 12](https://img.shields.io/badge/TYPO3-12-orange.svg?style=flat-square)](https://get.typo3.org/version/12) [![License](https://img.shields.io/badge/license-GPL--3.0-orange?style=flat-square)](https://www.gnu.org/licenses/gpl-3.0.en.html) [![T3Planet](https://img.shields.io/badge/T3Planet-PagesComment-50b99a?style=flat-square)](https://t3planet.com/typo3-page-comment-extension)

- Live Frontend Demo: https://demo.t3planet.com/t3-extensions/comments
- Live Backend Demo: https://demo.t3planet.com/live-typo3/t3t-extensions/typo3/?TYPO3_AUTOLOGIN_USER=editor-comments
Expand Down
12 changes: 0 additions & 12 deletions Resources/Private/Language/locallang_db.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,6 @@
<trans-unit id="flexform.userSettings">
<source>Comment user settings</source>
</trans-unit>
<trans-unit id="flexform.commnetlanguageFallbackMode">
<source>Language based comments</source>
</trans-unit>
<trans-unit id="sendMailToAdmin">
<source>Enable Mail: Enable Email to Admin</source>
</trans-unit>
Expand Down Expand Up @@ -222,15 +219,6 @@
<trans-unit id="termsTypolinkParameter">
<source>Terms typolink parameter</source>
</trans-unit>
<trans-unit id="flexform.languageFallbackMode">
<source>Language Fallback</source>
</trans-unit>
<trans-unit id="flexform.languageFallbackMode.strict">
<source>Default</source>
</trans-unit>
<trans-unit id="flexform.languageFallbackMode.translated">
<source>Language based comments</source>
</trans-unit>
<trans-unit id="termsText">
<source>Terms Text</source>
</trans-unit>
Expand Down

0 comments on commit 0a79a32

Please sign in to comment.