From: Alexander Ebert Date: Fri, 20 Jun 2014 10:14:00 +0000 (+0200) Subject: Added stacking support for wall comments X-Git-Tag: 2.1.0_Alpha_1~669^2~7 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=3603fe6ae48297eec37b5bfca3426dfccb1b78ce;p=GitHub%2FWoltLab%2FWCF.git Added stacking support for wall comments --- diff --git a/wcfsetup/install/files/lib/system/user/notification/event/UserProfileCommentResponseOwnerUserNotificationEvent.class.php b/wcfsetup/install/files/lib/system/user/notification/event/UserProfileCommentResponseOwnerUserNotificationEvent.class.php index 363d9ae29d..b024727c1c 100644 --- a/wcfsetup/install/files/lib/system/user/notification/event/UserProfileCommentResponseOwnerUserNotificationEvent.class.php +++ b/wcfsetup/install/files/lib/system/user/notification/event/UserProfileCommentResponseOwnerUserNotificationEvent.class.php @@ -17,10 +17,23 @@ use wcf\system\WCF; * @category Community Framework */ class UserProfileCommentResponseOwnerUserNotificationEvent extends AbstractUserNotificationEvent { + /** + * @see \wcf\system\user\notification\event\AbstractUserNotificationEvent::$stackable + */ + protected $stackable = true; + /** * @see \wcf\system\user\notification\event\IUserNotificationEvent::getTitle() */ public function getTitle() { + $count = count($this->getAuthors()); + if ($count > 1) { + return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponseOwner.title.stacked', array( + 'count' => $count, + 'timesTriggered' => $this->timesTriggered + )); + } + return $this->getLanguage()->get('wcf.user.notification.commentResponseOwner.title'); } @@ -39,6 +52,16 @@ class UserProfileCommentResponseOwnerUserNotificationEvent extends AbstractUserN )); } + $authors = array_values($this->getAuthors()); + $count = count($authors); + if ($count > 1) { + return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponseOwner.message.stacked', array( + 'authors' => $authors, + 'count' => $count, + 'others' => max($count - 1, 0) + )); + } + return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponseOwner.message', array( 'author' => $this->author, 'commentAuthor' => $commentAuthor @@ -75,4 +98,11 @@ class UserProfileCommentResponseOwnerUserNotificationEvent extends AbstractUserN public function getLink() { return LinkHandler::getInstance()->getLink('User', array('object' => WCF::getUser()), '#wall'); } + + /** + * @see \wcf\system\user\notification\event\IUserNotificationEvent::getEventHash() + */ + public function getEventHash() { + return sha1($this->eventID . '-' . $this->userNotificationObject->commentID); + } } diff --git a/wcfsetup/install/files/lib/system/user/notification/event/UserProfileCommentResponseUserNotificationEvent.class.php b/wcfsetup/install/files/lib/system/user/notification/event/UserProfileCommentResponseUserNotificationEvent.class.php index 335d6461b3..b5e54101b2 100644 --- a/wcfsetup/install/files/lib/system/user/notification/event/UserProfileCommentResponseUserNotificationEvent.class.php +++ b/wcfsetup/install/files/lib/system/user/notification/event/UserProfileCommentResponseUserNotificationEvent.class.php @@ -16,10 +16,23 @@ use wcf\system\user\notification\event\AbstractUserNotificationEvent; * @category Community Framework */ class UserProfileCommentResponseUserNotificationEvent extends AbstractUserNotificationEvent { + /** + * @see \wcf\system\user\notification\event\AbstractUserNotificationEvent::$stackable + */ + protected $stackable = true; + /** * @see \wcf\system\user\notification\event\IUserNotificationEvent::getTitle() */ public function getTitle() { + $count = count($this->getAuthors()); + if ($count > 1) { + return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponse.title.stacked', array( + 'count' => $count, + 'timesTriggered' => $this->timesTriggered + )); + } + return $this->getLanguage()->get('wcf.user.notification.commentResponse.title'); } @@ -29,6 +42,7 @@ class UserProfileCommentResponseUserNotificationEvent extends AbstractUserNotifi public function getMessage() { // @todo: use cache or a single query to retrieve required data $comment = new Comment($this->userNotificationObject->commentID); + $owner = new User($comment->objectID); if ($comment->userID) { $commentAuthor = new User($comment->userID); } @@ -38,9 +52,20 @@ class UserProfileCommentResponseUserNotificationEvent extends AbstractUserNotifi )); } + $authors = array_values($this->getAuthors()); + $count = count($authors); + if ($count > 1) { + return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponseOwner.message.stacked', array( + 'authors' => $authors, + 'count' => $count, + 'others' => max($count - 1, 0), + 'owner' => $owner + )); + } + return $this->getLanguage()->getDynamicVariable('wcf.user.notification.commentResponse.message', array( 'author' => $this->author, - 'owner' => $user + 'owner' => $owner )); } diff --git a/wcfsetup/install/files/lib/system/user/notification/event/UserProfileCommentUserNotificationEvent.class.php b/wcfsetup/install/files/lib/system/user/notification/event/UserProfileCommentUserNotificationEvent.class.php index 18ba1287b1..09eaef60dd 100644 --- a/wcfsetup/install/files/lib/system/user/notification/event/UserProfileCommentUserNotificationEvent.class.php +++ b/wcfsetup/install/files/lib/system/user/notification/event/UserProfileCommentUserNotificationEvent.class.php @@ -16,10 +16,23 @@ use wcf\system\WCF; * @category Community Framework */ class UserProfileCommentUserNotificationEvent extends AbstractUserNotificationEvent { + /** + * @see \wcf\system\user\notification\event\AbstractUserNotificationEvent::$stackable + */ + protected $stackable = true; + /** * @see \wcf\system\user\notification\event\IUserNotificationEvent::getTitle() */ public function getTitle() { + $count = count($this->getAuthors()); + if ($count > 1) { + return $this->getLanguage()->getDynamicVariable('wcf.user.notification.comment.title.stacked', array( + 'count' => $count, + 'timesTriggered' => $this->timesTriggered + )); + } + return $this->getLanguage()->get('wcf.user.notification.comment.title'); } @@ -27,6 +40,18 @@ class UserProfileCommentUserNotificationEvent extends AbstractUserNotificationEv * @see \wcf\system\user\notification\event\IUserNotificationEvent::getMessage() */ public function getMessage() { + $authors = array_values($this->getAuthors()); + $count = count($authors); + + if ($count > 1) { + return $this->getLanguage()->getDynamicVariable('wcf.user.notification.comment.message.stacked', array( + 'author' => $this->author, + 'authors' => $authors, + 'count' => $count, + 'others' => max($count - 1, 0) + )); + } + return $this->getLanguage()->getDynamicVariable('wcf.user.notification.comment.message', array( 'author' => $this->author )); @@ -52,4 +77,11 @@ class UserProfileCommentUserNotificationEvent extends AbstractUserNotificationEv public function getLink() { return LinkHandler::getInstance()->getLink('User', array('object' => WCF::getUser()), '#wall'); } + + /** + * @see \wcf\system\user\notification\event\IUserNotificationEvent::getEventHash() + */ + public function getEventHash() { + return sha1($this->eventID . '-' . $this->notification->userID); + } } diff --git a/wcfsetup/install/lang/de.xml b/wcfsetup/install/lang/de.xml index ac93d3f6a2..21510b23f8 100644 --- a/wcfsetup/install/lang/de.xml +++ b/wcfsetup/install/lang/de.xml @@ -2856,7 +2856,9 @@ Möchten Sie diese E-Mail-Benachrichtigung in Zukunft nicht mehr erhalten, könn + + getAnchorTag()}{if $count == 2} und {else}, {/if}{@$authors[1]->getAnchorTag()}{if $count == 3} und {@$authors[2]->getAnchorTag()}{/if}{else}{@$authors[0]->getAnchorTag()} und {#$count} weitere{/if} haben Kommentare an Ihrer Pinnwand verfasst.]]> username} hat einen Kommentar an Ihrer Pinnwand verfasst: {if $notificationType == 'instant'} --------------------------------- @@ -2864,7 +2866,9 @@ Möchten Sie diese E-Mail-Benachrichtigung in Zukunft nicht mehr erhalten, könn --------------------------------- {/if}{link controller='User' object=$owner isEmail=true}{/link}#wall]]> + username} verfasst.]]> + getAnchorTag()}{if $count == 2} und {else}, {/if}{@$authors[1]->getAnchorTag()}{if $count == 3} und {@$authors[2]->getAnchorTag()}{/if}{else}{@$authors[0]->getAnchorTag()} und {#$count} weitere{/if} haben auf Ihren Kommentare an der Pinnwand von {$owner->username} geantwortet.]]> username} hat eine Antwort zu Ihrem Kommentar an der Pinnwand von "{@$owner->username}" verfasst: {if $notificationType == 'instant'} --------------------------------- @@ -2872,7 +2876,9 @@ Möchten Sie diese E-Mail-Benachrichtigung in Zukunft nicht mehr erhalten, könn --------------------------------- {/if}{link controller='User' object=$owner isEmail=true}{/link}#wall]]> + username} an Ihrer Pinnwand verfasst.]]> + getAnchorTag()}{if $count == 2} und {else}, {/if}{@$authors[1]->getAnchorTag()}{if $count == 3} und {@$authors[2]->getAnchorTag()}{/if}{else}{@$authors[0]->getAnchorTag()} und {#$count} weitere{/if} haben auf Kommentare an Ihrer Pinnwand geantwortet.]]> username} hat eine Antwort zum Kommentar von "{@$commentAuthor->username}" an Ihrer Pinnwand verfasst: {if $notificationType == 'instant'} ---------------------------------