<definitionname>com.woltlab.wcf.user.recentActivityEvent</definitionname>
<classname>wcf\system\user\activity\event\LikeableArticleUserActivityEvent</classname>
</type>
+ <type>
+ <name>com.woltlab.wcf.articleComment.recentActivityEvent</name>
+ <definitionname>com.woltlab.wcf.user.recentActivityEvent</definitionname>
+ <classname>wcf\system\user\activity\event\ArticleCommentUserActivityEvent</classname>
+ </type>
+ <type>
+ <name>com.woltlab.wcf.articleComment.response.recentActivityEvent</name>
+ <definitionname>com.woltlab.wcf.user.recentActivityEvent</definitionname>
+ <classname>wcf\system\user\activity\event\ArticleCommentResponseUserActivityEvent</classname>
+ </type>
<type>
<name>com.woltlab.wcf.article</name>
<definitionname>com.woltlab.wcf.searchableObjectType</definitionname>
</type>
<type>
- <name>com.woltlab.wcf.article</name>
+ <name>com.woltlab.wcf.articleComment</name>
<definitionname>com.woltlab.wcf.comment.commentableContent</definitionname>
<classname><![CDATA[wcf\system\comment\manager\ArticleCommentManager]]></classname>
</type>
// delete like data
LikeHandler::getInstance()->removeLikes('com.woltlab.wcf.likeableArticle', $articleIDs);
// delete comments
- CommentHandler::getInstance()->deleteObjects('com.woltlab.wcf.article', $articleContentIDs);
+ CommentHandler::getInstance()->deleteObjects('com.woltlab.wcf.articleComment', $articleContentIDs);
// delete tag to object entries
TagEngine::getInstance()->deleteObjects('com.woltlab.wcf.article', $articleContentIDs);
// delete entry from search index
// get comments
if ($this->article->enableComments) {
- $this->commentObjectTypeID = CommentHandler::getInstance()->getObjectTypeID('com.woltlab.wcf.article');
+ $this->commentObjectTypeID = CommentHandler::getInstance()->getObjectTypeID('com.woltlab.wcf.articleComment');
$this->commentManager = CommentHandler::getInstance()->getObjectType($this->commentObjectTypeID)->getProcessor();
$this->commentList = CommentHandler::getInstance()->getCommentList($this->commentManager, $this->commentObjectTypeID, $this->articleContent->articleContentID);
}
--- /dev/null
+<?php
+namespace wcf\system\user\activity\event;
+use wcf\data\article\ViewableArticleList;
+use wcf\data\comment\response\CommentResponseList;
+use wcf\data\comment\CommentList;
+use wcf\data\user\UserList;
+use wcf\system\SingletonFactory;
+use wcf\system\WCF;
+
+/**
+ * User activity event implementation for responses to article comments.
+ *
+ * @author Marcel Werk
+ * @copyright 2001-2016 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package com.woltlab.wcf
+ * @subpackage system.user.activity.event
+ * @category Community Framework
+ * @since 2.2
+ */
+class ArticleCommentResponseUserActivityEvent extends SingletonFactory implements IUserActivityEvent {
+ /**
+ * @inheritDoc
+ */
+ public function prepare(array $events) {
+ $responseIDs = [];
+ foreach ($events as $event) {
+ $responseIDs[] = $event->objectID;
+ }
+
+ // fetch responses
+ $responseList = new CommentResponseList();
+ $responseList->setObjectIDs($responseIDs);
+ $responseList->readObjects();
+ $responses = $responseList->getObjects();
+
+ // fetch comments
+ $commentIDs = $comments = [];
+ foreach ($responses as $response) {
+ $commentIDs[] = $response->commentID;
+ }
+ if (!empty($commentIDs)) {
+ $commentList = new CommentList();
+ $commentList->setObjectIDs($commentIDs);
+ $commentList->readObjects();
+ $comments = $commentList->getObjects();
+ }
+
+ // fetch articles
+ $articleIDs = $articles = [];
+ foreach ($comments as $comment) {
+ $articleIDs[] = $comment->objectID;
+ }
+ if (!empty($articleIDs)) {
+ $articleList = new ViewableArticleList();
+ $articleList->setObjectIDs($articleIDs);
+ $articleList->readObjects();
+ $articles = $articleList->getObjects();
+ }
+
+ // fetch users
+ $userIDs = $user = [];
+ foreach ($comments as $comment) {
+ $userIDs[] = $comment->userID;
+ }
+ if (!empty($userIDs)) {
+ $userList = new UserList();
+ $userList->setObjectIDs($userIDs);
+ $userList->readObjects();
+ $users = $userList->getObjects();
+ }
+
+ // set message
+ foreach ($events as $event) {
+ if (isset($responses[$event->objectID])) {
+ $response = $responses[$event->objectID];
+ $comment = $comments[$response->commentID];
+ if (isset($articles[$comment->objectID]) && isset($users[$comment->userID])) {
+ $article = $articles[$comment->objectID];
+
+ // check permissions
+ if (!$article->canRead()) {
+ continue;
+ }
+ $event->setIsAccessible();
+
+ // title
+ $text = WCF::getLanguage()->getDynamicVariable('wcf.article.recentActivity.articleCommentResponse', [
+ 'commentAuthor' => $users[$comment->userID],
+ 'article' => $article
+ ]);
+ $event->setTitle($text);
+
+ // description
+ $event->setDescription($response->getExcerpt());
+ continue;
+ }
+ }
+
+ $event->setIsOrphaned();
+ }
+ }
+}
--- /dev/null
+<?php
+namespace wcf\system\user\activity\event;
+use wcf\data\article\ViewableArticleList;
+use wcf\data\comment\CommentList;
+use wcf\system\SingletonFactory;
+use wcf\system\WCF;
+
+/**
+ * User activity event implementation for article comments.
+ *
+ * @author Marcel Werk
+ * @copyright 2001-2016 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package com.woltlab.wcf
+ * @subpackage system.user.activity.event
+ * @category Community Framework
+ * @since 2.2
+ */
+class ArticleCommentUserActivityEvent extends SingletonFactory implements IUserActivityEvent {
+ /**
+ * @inheritDoc
+ */
+ public function prepare(array $events) {
+ $commentIDs = [];
+ foreach ($events as $event) {
+ $commentIDs[] = $event->objectID;
+ }
+
+ // fetch comments
+ $commentList = new CommentList();
+ $commentList->setObjectIDs($commentIDs);
+ $commentList->readObjects();
+ $comments = $commentList->getObjects();
+
+ // fetch articles
+ $articleIDs = $articles = [];
+ foreach ($comments as $comment) {
+ $articleIDs[] = $comment->objectID;
+ }
+ if (!empty($articleIDs)) {
+ $articleList = new ViewableArticleList();
+ $articleList->setObjectIDs($articleIDs);
+ $articleList->readObjects();
+ $articles = $articleList->getObjects();
+ }
+
+ // set message
+ foreach ($events as $event) {
+ if (isset($comments[$event->objectID])) {
+ // short output
+ $comment = $comments[$event->objectID];
+ if (isset($articles[$comment->objectID])) {
+ $article = $articles[$comment->objectID];
+
+ // check permissions
+ if (!$article->canRead()) {
+ continue;
+ }
+ $event->setIsAccessible();
+
+ // add title
+ $text = WCF::getLanguage()->getDynamicVariable('wcf.article.recentActivity.articleComment', ['article' => $article]);
+ $event->setTitle($text);
+
+ // add text
+ $event->setDescription($comment->getExcerpt());
+ continue;
+ }
+ }
+
+ $event->setIsOrphaned();
+ }
+ }
+}
}
$articles = $this->objectList->getObjects();
- $commentObjectType = ObjectTypeCache::getInstance()->getObjectTypeByName('com.woltlab.wcf.comment.commentableContent', 'com.woltlab.wcf.article');
+ $commentObjectType = ObjectTypeCache::getInstance()->getObjectTypeByName('com.woltlab.wcf.comment.commentableContent', 'com.woltlab.wcf.articleComment');
$sql = "SELECT COUNT(*) AS comments, SUM(responses) AS responses
FROM wcf".WCF_N."_comment
WHERE objectTypeID = ?
<item name="wcf.article.articleComments"><![CDATA[{#$article->comments} Kommentar{if $article->comments != 1}e{/if}]]></item>
<item name="wcf.article.articleViews"><![CDATA[{#$article->views} mal gelesen]]></item>
<item name="wcf.article.recentActivity.likedArticle"><![CDATA[Mag den Artikel <a href="{$article->getLink()}">{$article->getTitle()}</a>.]]></item>
+ <item name="wcf.article.recentActivity.articleComment"><![CDATA[Hat einen Kommentar zum Artikel <a href="{$article->getLink()}#comments">{$article->getTitle()}</a> geschrieben.]]></item>
+ <item name="wcf.article.recentActivity.articleCommentResponse"><![CDATA[Hat auf einen Kommentar von <a href="{link controller='User' object=$commentAuthor}{/link}">{$commentAuthor->username}</a> zum Artikel <a href="{$article->getLink()}#comments">{$article->getTitle()}</a> geantwortet.]]></item>
</category>
<category name="wcf.attachment">
<item name="wcf.user.recentActivity.com.woltlab.wcf.user.profileComment.recentActivityEvent"><![CDATA[Pinnwand-Kommentar]]></item>
<item name="wcf.user.recentActivity.com.woltlab.wcf.user.profileComment.response.recentActivityEvent"><![CDATA[Pinnwand-Antwort]]></item>
<item name="wcf.user.recentActivity.com.woltlab.wcf.likeableArticle.recentActivityEvent"><![CDATA[Like (Artikel)]]></item>
+ <item name="wcf.user.recentActivity.com.woltlab.wcf.articleComment.recentActivityEvent"><![CDATA[Kommentar (Artikel)]]></item>
+ <item name="wcf.user.recentActivity.com.woltlab.wcf.articleComment.response.recentActivityEvent"><![CDATA[Antwort (Artikel)]]></item>
<item name="wcf.user.recentActivity.scope.all"><![CDATA[Aktivitäten aller Benutzer]]></item>
<item name="wcf.user.recentActivity.scope.followedUsers"><![CDATA[Aktivitäten von Benutzern, denen Sie folgen]]></item>
</category>
<item name="wcf.article.articleComments"><![CDATA[{#$article->comments} Comment{if $article->comments != 1}s{/if}]]></item>
<item name="wcf.article.articleViews"><![CDATA[{#$article->views} View{if $article->views != 1}s{/if}]]></item>
<item name="wcf.article.recentActivity.likedArticle"><![CDATA[Liked the article <a href="{$article->getLink()}">{$article->getTitle()}</a>.]]></item>
+ <item name="wcf.article.recentActivity.articleComment"><![CDATA[Commented on article <a href="{$article->getLink()}">{$article->getTitle()}</a>.]]></item>
+ <item name="wcf.article.recentActivity.articleCommentResponse"><![CDATA[Replied to a comment by <a href="{link controller='User' object=$commentAuthor}{/link}">{$commentAuthor->username}</a> on article <a href="{$article->getLink()}">{$article->getTitle()}</a>.]]></item>
</category>
<category name="wcf.attachment">
<item name="wcf.user.recentActivity.com.woltlab.wcf.user.profileComment.recentActivityEvent"><![CDATA[Wall Comment]]></item>
<item name="wcf.user.recentActivity.com.woltlab.wcf.user.profileComment.response.recentActivityEvent"><![CDATA[Wall Reply]]></item>
<item name="wcf.user.recentActivity.com.woltlab.wcf.likeableArticle.recentActivityEvent"><![CDATA[Like (Article)]]></item>
+ <item name="wcf.user.recentActivity.com.woltlab.wcf.articleComment.recentActivityEvent"><![CDATA[Comment (Article)]]></item>
+ <item name="wcf.user.recentActivity.com.woltlab.wcf.articleComment.response.recentActivityEvent"><![CDATA[Reply (Article)]]></item>
<item name="wcf.user.recentActivity.scope.all"><![CDATA[All Activities]]></item>
<item name="wcf.user.recentActivity.scope.followedUsers"><![CDATA[Filter by Followed Users]]></item>
</category>