{if !$commentManager|isset}{assign var='commentManager' value=$commentList->getCommentManager()}{/if}
{if !$commentCanModerate|isset}{assign var=commentCanModerate value=$commentManager->canModerate($commentList->objectTypeID, $commentList->objectID)}{/if}
{foreach from=$commentList item=comment}
- <li class="comment jsComment"
- data-object-id="{@$comment->commentID}" data-comment-id="{@$comment->commentID}" data-object-type="com.woltlab.wcf.comment"
- data-like-liked="{if $likeData[comment][$comment->commentID]|isset}{@$likeData[comment][$comment->commentID]->liked}{/if}" data-like-likes="{if $likeData[comment][$comment->commentID]|isset}{@$likeData[comment][$comment->commentID]->likes}{else}0{/if}" data-like-dislikes="{if $likeData[comment][$comment->commentID]|isset}{@$likeData[comment][$comment->commentID]->dislikes}{else}0{/if}" data-like-users='{if $likeData[comment][$comment->commentID]|isset}{ {implode from=$likeData[comment][$comment->commentID]->getUsers() item=likeUser}"{@$likeUser->userID}": { "username": "{$likeUser->username|encodeJSON}" }{/implode} }{else}{ }{/if}'
- data-can-edit="{if $comment->isEditable()}true{else}false{/if}" data-can-delete="{if $comment->isDeletable()}true{else}false{/if}"
- data-responses="{@$comment->responses}" data-last-response-time="{@$comment->getLastResponseTime()}" data-user-id="{@$comment->userID}" data-is-disabled="{@$comment->isDisabled}">
- <div class="box48">
- {if $comment->userID}
- <a href="{link controller='User' object=$comment->getUserProfile()}{/link}" title="{$comment->getUserProfile()->username}">
+ {if $comment->isDisabled && !$commentCanModerate}
+ <li>
+ <p class="info commentModerationDisabledComment">{lang}wcf.comment.moderation.disabledComment{/lang}</p>
+ </li>
+ {else}
+ <li class="comment jsComment"
+ data-object-id="{@$comment->commentID}" data-comment-id="{@$comment->commentID}" data-object-type="com.woltlab.wcf.comment"
+ data-like-liked="{if $likeData[comment][$comment->commentID]|isset}{@$likeData[comment][$comment->commentID]->liked}{/if}" data-like-likes="{if $likeData[comment][$comment->commentID]|isset}{@$likeData[comment][$comment->commentID]->likes}{else}0{/if}" data-like-dislikes="{if $likeData[comment][$comment->commentID]|isset}{@$likeData[comment][$comment->commentID]->dislikes}{else}0{/if}" data-like-users='{if $likeData[comment][$comment->commentID]|isset}{ {implode from=$likeData[comment][$comment->commentID]->getUsers() item=likeUser}"{@$likeUser->userID}": { "username": "{$likeUser->username|encodeJSON}" }{/implode} }{else}{ }{/if}'
+ data-can-edit="{if $comment->isEditable()}true{else}false{/if}" data-can-delete="{if $comment->isDeletable()}true{else}false{/if}"
+ data-responses="{@$comment->responses}" data-last-response-time="{@$comment->getLastResponseTime()}" data-user-id="{@$comment->userID}" data-is-disabled="{@$comment->isDisabled}">
+ <div class="box48">
+ {if $comment->userID}
+ <a href="{link controller='User' object=$comment->getUserProfile()}{/link}" title="{$comment->getUserProfile()->username}">
+ {@$comment->getUserProfile()->getAvatar()->getImageTag(48)}
+ </a>
+ {else}
{@$comment->getUserProfile()->getAvatar()->getImageTag(48)}
- </a>
- {else}
- {@$comment->getUserProfile()->getAvatar()->getImageTag(48)}
- {/if}
-
- <div class="commentContentContainer" itemprop="comment" itemscope itemtype="http://schema.org/Comment">
- <div class="commentContent">
- <meta itemprop="dateCreated" content="{@$comment->time|date:'c'}">
-
- <div class="containerHeadline">
- <h3 itemprop="author" itemscope itemtype="http://schema.org/Person">
- {if $comment->userID}
- <a href="{link controller='User' object=$comment->getUserProfile()}{/link}" class="userLink" data-user-id="{@$comment->userID}" itemprop="url">
+ {/if}
+
+ <div class="commentContentContainer" itemprop="comment" itemscope itemtype="http://schema.org/Comment">
+ <div class="commentContent">
+ <meta itemprop="dateCreated" content="{@$comment->time|date:'c'}">
+
+ <div class="containerHeadline">
+ <h3 itemprop="author" itemscope itemtype="http://schema.org/Person">
+ {if $comment->userID}
+ <a href="{link controller='User' object=$comment->getUserProfile()}{/link}" class="userLink" data-user-id="{@$comment->userID}" itemprop="url">
+ <span itemprop="name">{$comment->username}</span>
+ </a>
+ {else}
<span itemprop="name">{$comment->username}</span>
- </a>
- {else}
- <span itemprop="name">{$comment->username}</span>
- {/if}
-
- <small class="separatorLeft">{@$comment->time|time}</small>
-
- {if $comment->isDisabled}
- <span class="badge label green jsIconDisabled">{lang}wcf.message.status.disabled{/lang}</span>
- {/if}
- </h3>
+ {/if}
+
+ <small class="separatorLeft">{@$comment->time|time}</small>
+
+ {if $comment->isDisabled}
+ <span class="badge label green jsIconDisabled">{lang}wcf.message.status.disabled{/lang}</span>
+ {/if}
+ </h3>
+ </div>
+
+ <div class="userMessage" itemprop="text">{@$comment->getFormattedMessage()}</div>
+
+ <nav class="jsMobileNavigation buttonGroupNavigation">
+ <ul class="buttonList iconList">
+ {if $comment->isDisabled && $commentCanModerate}
+ <li class="jsOnly"><a href="#" class="jsEnableComment"><span class="icon icon16 fa-check"></span> <span class="invisible">{lang}wcf.comment.approve{/lang}</span></a></li>
+ {/if}
+ {if $commentManager->supportsReport() && $__wcf->session->getPermission('user.profile.canReportContent')}
+ <li class="jsReportCommentComment jsOnly" data-object-id="{@$comment->commentID}"><a href="#" title="{lang}wcf.moderation.report.reportContent{/lang}" class="jsTooltip"><span class="icon icon16 fa-exclamation-triangle"></span> <span class="invisible">{lang}wcf.moderation.report.reportContent{/lang}</span></a></li>
+ {/if}
+
+ {event name='commentOptions'}
+ </ul>
+ </nav>
</div>
- <div class="userMessage" itemprop="text">{@$comment->getFormattedMessage()}</div>
-
- <nav class="jsMobileNavigation buttonGroupNavigation">
- <ul class="buttonList iconList">
- {if $comment->isDisabled && $commentCanModerate}
- <li class="jsOnly"><a href="#" class="jsEnableComment"><span class="icon icon16 fa-check"></span> <span class="invisible">{lang}wcf.comment.approve{/lang}</span></a></li>
- {/if}
- {if $commentManager->supportsReport() && $__wcf->session->getPermission('user.profile.canReportContent')}
- <li class="jsReportCommentComment jsOnly" data-object-id="{@$comment->commentID}"><a href="#" title="{lang}wcf.moderation.report.reportContent{/lang}" class="jsTooltip"><span class="icon icon16 fa-exclamation-triangle"></span> <span class="invisible">{lang}wcf.moderation.report.reportContent{/lang}</span></a></li>
- {/if}
-
- {event name='commentOptions'}
+ {if $comment|count}
+ <ul data-responses="{if $commentCanModerate}{@$comment->unfilteredResponses}{else}{@$comment->responses}{/if}" class="containerList commentResponseList">
+ {include file='commentResponseList' responseList=$comment}
</ul>
- </nav>
+ {/if}
</div>
-
- {if $comment|count}
- <ul data-responses="{if $commentCanModerate}{@$comment->unfilteredResponses}{else}{@$comment->responses}{/if}" class="containerList commentResponseList">
- {include file='commentResponseList' responseList=$comment}
- </ul>
- {/if}
</div>
- </div>
- </li>
+ </li>
+ {/if}
{/foreach}
<div class="commentListAddComment collapsed" data-placeholder="{lang}wcf.comment.add{/lang}">
<div class="commentListAddCommentEditorContainer">
{if !$commentList->getCommentManager()->canAddWithoutApproval($commentList->objectID)}
- <p class="info jsCommentAddRequiresApproval">{lang}wcf.comment.add.moderation.info{/lang}</p>
+ <p class="info jsCommentAddRequiresApproval">{lang}wcf.comment.moderation.info{/lang}</p>
{/if}
<textarea id="{$wysiwygSelector}" name="text" class="wysiwygTextarea"
{foreach from=$responseList item=response}
- <li class="commentResponse jsCommentResponse" data-object-id="{@$response->responseID}" data-response-id="{@$response->responseID}" data-object-type="com.woltlab.wcf.comment.response" data-like-liked="{if $likeData[response][$response->responseID]|isset}{@$likeData[response][$response->responseID]->liked}{/if}" data-like-likes="{if $likeData[response][$response->responseID]|isset}{@$likeData[response][$response->responseID]->likes}{else}0{/if}" data-like-dislikes="{if $likeData[response][$response->responseID]|isset}{@$likeData[response][$response->responseID]->dislikes}{else}0{/if}" data-like-users='{if $likeData[response][$response->responseID]|isset}{ {implode from=$likeData[response][$response->responseID]->getUsers() item=likeUser}"{@$likeUser->userID}": { "username": "{$likeUser->username|encodeJSON}" }{/implode} }{else}{ }{/if}' data-can-edit="{if $response->isEditable()}true{else}false{/if}" data-can-delete="{if $response->isDeletable()}true{else}false{/if}" data-user-id="{@$response->userID}">
- <div class="box32">
- {if $response->userID}
- <a href="{link controller='User' object=$response->getUserProfile()}{/link}" title="{$response->getUserProfile()->username}">
+ {if $response->isDisabled && $commentCanModerate|isset && !$commentCanModerate}
+ <li>
+ <p class="info commentModerationDisabledComment">{lang}wcf.comment.moderation.disabledComment{/lang}</p>
+ </li>
+ {else}
+ <li class="commentResponse jsCommentResponse" data-object-id="{@$response->responseID}" data-response-id="{@$response->responseID}" data-object-type="com.woltlab.wcf.comment.response" data-like-liked="{if $likeData[response][$response->responseID]|isset}{@$likeData[response][$response->responseID]->liked}{/if}" data-like-likes="{if $likeData[response][$response->responseID]|isset}{@$likeData[response][$response->responseID]->likes}{else}0{/if}" data-like-dislikes="{if $likeData[response][$response->responseID]|isset}{@$likeData[response][$response->responseID]->dislikes}{else}0{/if}" data-like-users='{if $likeData[response][$response->responseID]|isset}{ {implode from=$likeData[response][$response->responseID]->getUsers() item=likeUser}"{@$likeUser->userID}": { "username": "{$likeUser->username|encodeJSON}" }{/implode} }{else}{ }{/if}' data-can-edit="{if $response->isEditable()}true{else}false{/if}" data-can-delete="{if $response->isDeletable()}true{else}false{/if}" data-user-id="{@$response->userID}">
+ <div class="box32">
+ {if $response->userID}
+ <a href="{link controller='User' object=$response->getUserProfile()}{/link}" title="{$response->getUserProfile()->username}">
+ {@$response->getUserProfile()->getAvatar()->getImageTag(32)}
+ </a>
+ {else}
{@$response->getUserProfile()->getAvatar()->getImageTag(32)}
- </a>
- {else}
- {@$response->getUserProfile()->getAvatar()->getImageTag(32)}
- {/if}
-
- <div class="commentContent commentResponseContent" itemprop="comment" itemscope itemtype="http://schema.org/Comment">
- <meta itemprop="dateCreated" content="{@$response->time|date:'c'}">
+ {/if}
- <div class="containerHeadline">
- <h3 itemprop="author" itemscope itemtype="http://schema.org/Person">
- {if $response->userID}
- <a href="{link controller='User' object=$response->getUserProfile()}{/link}" class="userLink" data-user-id="{@$response->userID}" itemprop="url">
+ <div class="commentContent commentResponseContent" itemprop="comment" itemscope itemtype="http://schema.org/Comment">
+ <meta itemprop="dateCreated" content="{@$response->time|date:'c'}">
+
+ <div class="containerHeadline">
+ <h3 itemprop="author" itemscope itemtype="http://schema.org/Person">
+ {if $response->userID}
+ <a href="{link controller='User' object=$response->getUserProfile()}{/link}" class="userLink" data-user-id="{@$response->userID}" itemprop="url">
+ <span itemprop="name">{$response->username}</span>
+ </a>
+ {else}
<span itemprop="name">{$response->username}</span>
- </a>
- {else}
- <span itemprop="name">{$response->username}</span>
- {/if}
-
- <small class="separatorLeft">{@$response->time|time}</small>
-
- {if $response->isDisabled}
- <span class="badge label green jsIconDisabled">{lang}wcf.message.status.disabled{/lang}</span>
- {/if}
- </h3>
+ {/if}
+
+ <small class="separatorLeft">{@$response->time|time}</small>
+
+ {if $response->isDisabled}
+ <span class="badge label green jsIconDisabled">{lang}wcf.message.status.disabled{/lang}</span>
+ {/if}
+ </h3>
+ </div>
+
+ <div class="userMessage" itemprop="text">{@$response->getFormattedMessage()}</div>
+
+ <nav class="jsMobileNavigation buttonGroupNavigation">
+ <ul class="buttonList iconList">
+ {if $commentManager->supportsReport() && $__wcf->session->getPermission('user.profile.canReportContent')}
+ <li class="jsReportCommentResponse jsOnly" data-object-id="{@$response->responseID}"><a href="#" title="{lang}wcf.moderation.report.reportContent{/lang}" class="jsTooltip"><span class="icon icon16 fa-exclamation-triangle"></span> <span class="invisible">{lang}wcf.moderation.report.reportContent{/lang}</span></a></li>
+ {/if}
+
+ {event name='commentOptions'}
+ </ul>
+ </nav>
</div>
-
- <div class="userMessage" itemprop="text">{@$response->getFormattedMessage()}</div>
-
- <nav class="jsMobileNavigation buttonGroupNavigation">
- <ul class="buttonList iconList">
- {if $commentManager->supportsReport() && $__wcf->session->getPermission('user.profile.canReportContent')}
- <li class="jsReportCommentResponse jsOnly" data-object-id="{@$response->responseID}"><a href="#" title="{lang}wcf.moderation.report.reportContent{/lang}" class="jsTooltip"><span class="icon icon16 fa-exclamation-triangle"></span> <span class="invisible">{lang}wcf.moderation.report.reportContent{/lang}</span></a></li>
- {/if}
-
- {event name='commentOptions'}
- </ul>
- </nav>
</div>
- </div>
- </li>
+ </li>
+ {/if}
{/foreach}
}
else {
/** @var ICommentUserNotificationObjectType $notificationObjectType */
-
$userID = $notificationObjectType->getOwnerID($comment->commentID);
if ($comment->userID != WCF::getUser()->userID) {
// render response
WCF::getTPL()->assign([
'responseList' => [$response],
+ 'commentCanModerate' => $this->commentProcessor->canModerate($response->getComment()->objectTypeID, $response->getComment()->objectID),
'commentManager' => $this->commentProcessor
]);
return WCF::getTPL()->fetch('commentResponseList');
$this->sqlLimit = $this->commentManager->getCommentsPerPage();
if (!$this->commentManager->canModerate($objectTypeID, $objectID)) {
- if (WCF::getUser()->userID) $this->getConditionBuilder()->add('(comment.isDisabled = 0 OR comment.userID = ?)', [WCF::getUser()->userID]);
- else $this->getConditionBuilder()->add('comment.isDisabled = 0');
+ $this->getConditionBuilder()->add('comment.isDisabled = 0');
}
}
public function readObjects() {
parent::readObjects();
+ $canModerate = $this->commentManager->canModerate($this->objectTypeID, $this->objectID);
+
// fetch response ids
$responseIDs = $userIDs = [];
/** @var Comment $comment */
if (!$this->minCommentTime || $comment->time < $this->minCommentTime) $this->minCommentTime = $comment->time;
if ($this->responseLoading) {
- $commentResponseIDs = $comment->getResponseIDs();
+ $commentResponseIDs = ($canModerate) ? $comment->getUnfilteredResponseIDs() : $comment->getResponseIDs();
foreach ($commentResponseIDs as $responseID) {
$this->responseIDs[] = $responseID;
$responseIDs[$responseID] = $comment->commentID;
// fetch last responses
if (!empty($responseIDs)) {
$responseList = new CommentResponseList();
+ $responseList->setObjectIDs(array_keys($responseIDs));
if ($this->commentManager->canModerate($this->objectTypeID, $this->objectID)) {
- $responseList->setObjectIDs(array_keys($responseIDs));
+
}
else {
$responseList->getConditionBuilder()->add('comment_response.responseID IN (?)', [array_keys($responseIDs)]);
-
- if (WCF::getUser()->userID) $responseList->getConditionBuilder()->add('(comment_response.isDisabled = 0 OR comment_response.userID = ?)', [WCF::getUser()->userID]);
- else $responseList->getConditionBuilder()->add('comment_response.isDisabled = 0');
+ $responseList->getConditionBuilder()->add('comment_response.isDisabled = 0');
}
$responseList->readObjects();
.jsEnableComment > .invisible {
display: inline;
}
+
+.commentModerationDisabledComment {
+ margin: 0 -20px;
+}
<category name="wcf.comment">
<item name="wcf.comment.add"><![CDATA[Kommentar schreiben …]]></item>
- <item name="wcf.comment.add.moderation.info"><![CDATA[Neu erstellte Kommentare unterliegen der Moderation und werden erst sichtbar, wenn sie durch einen Moderator geprüft und freigeschaltet wurden.]]></item>
<item name="wcf.comment.approve"><![CDATA[Freischalten]]></item>
<item name="wcf.comment.delete.confirmMessage"><![CDATA[{if LANGUAGE_USE_INFORMAL_VARIANT}Willst du{else}Wollen Sie{/if} diesen Kommentar wirklich löschen?]]></item>
<item name="wcf.comment.description"><![CDATA[{if LANGUAGE_USE_INFORMAL_VARIANT}Drücke{else}Drücken Sie{/if} die Eingabetaste, um abzusenden oder Escape, um abzubrechen.]]></item>
<item name="wcf.comment.error.floodControl"><![CDATA[{if LANGUAGE_USE_INFORMAL_VARIANT}Du hast{else}Sie haben{/if} bereits einen Kommentar innerhalb der letzten {if $__wcf->getSession()->getPermission('user.comment.floodControlTime') > 1}{#$__wcf->getSession()->getPermission('user.comment.floodControlTime')} Sekunden{else}Sekunde{/if} geschrieben. {if LANGUAGE_USE_INFORMAL_VARIANT}Du kannst{else}Sie können{/if} erst in {#$lastCommentTime+$__wcf->getSession()->getPermission('user.comment.floodControlTime')-TIME_NOW} Sekunde{if ($lastCommentTime+$__wcf->getSession()->getPermission('user.comment.floodControlTime')-TIME_NOW) != 1}n{/if} einen neuen Kommentar erstellen.]]></item>
<item name="wcf.comment.more"><![CDATA[Weitere Kommentare]]></item>
+ <item name="wcf.comment.moderation.info"><![CDATA[Neu erstellte Kommentare unterliegen der Moderation und werden erst sichtbar, wenn sie durch einen Moderator geprüft und freigeschaltet wurden.]]></item>
+ <item name="wcf.comment.moderation.disabledComment"><![CDATA[{if LANGUAGE_USE_INFORMAL_VARIANT}Dein{else}Ihr{/if} Kommentar muss zunächst von einem Moderator geprüft und freigeschaltet werden, damit er für alle Benutzer sichtbar wird.]]></item>
<item name="wcf.comment.response.add"><![CDATA[Antworten …]]></item>
<item name="wcf.comment.response.more"><![CDATA[{literal}{if $count == 1}Eine weitere Antwort{else}{#$count} weitere Antworten{/if}{/literal}]]></item>
<item name="wcf.comment.button.response.add"><![CDATA[Antworten]]></item>
<category name="wcf.comment">
<item name="wcf.comment.add"><![CDATA[Write a comment …]]></item>
- <item name="wcf.comment.add.moderation.info"><![CDATA[Newly created comments need to be manually approved before publication, other users cannot see this comment until it has been approved.]]></item>
<item name="wcf.comment.approve"><![CDATA[Approve]]></item>
<item name="wcf.comment.delete.confirmMessage"><![CDATA[Do you really want to delete this comment?]]></item>
<item name="wcf.comment.description"><![CDATA[Press Enter to send or Escape to cancel.]]></item>
<item name="wcf.comment.error.floodControl"><![CDATA[You have already written a comment within the last {if $__wcf->getSession()->getPermission('user.comment.floodControlTime') > 1}{#$__wcf->getSession()->getPermission('user.comment.floodControlTime')} seconds{else}second{/if}. You must wait at least {#$lastCommentTime+$__wcf->getSession()->getPermission('user.comment.floodControlTime')-TIME_NOW} second{if ($lastCommentTime+$__wcf->getSession()->getPermission('user.comment.floodControlTime')-TIME_NOW) != 1}s{/if} before attempting to write a new comment.]]></item>
+ <item name="wcf.comment.moderation.info"><![CDATA[Newly created comments need to be manually approved before publication, other users cannot see this comment until it has been approved.]]></item>
+ <item name="wcf.comment.moderation.disabledComment"><![CDATA[Your comment requires approval by a moderator, until then it will remain invisible for others.]]></item>
<item name="wcf.comment.more"><![CDATA[More Comments]]></item>
<item name="wcf.comment.response.add"><![CDATA[Reply …]]></item>
<item name="wcf.comment.response.more"><![CDATA[{literal}{if $count == 1}One more reply{else}{#$count} more replies{/if}{/literal}]]></item>