_convertList: function() {
$('.userNotificationItemList > .notificationItem').each((function(index, item) {
var $item = $(item);
+ var $isConfirmed = $item.data('isConfirmed');
- if (!$.browser.mobile && !$item.data('isConfirmed')) {
- var $markAsConfirmed = $('<a href="#" class="icon icon24 fa-check green notificationItemMarkAsConfirmed jsTooltip" title="' + WCF.Language.get('wcf.user.notification.markAsConfirmed') + '" />').prependTo($item.find('> div.box24 > .framed'));
- $markAsConfirmed.click($.proxy(this._markAsConfirmed, this));
+ if (!$isConfirmed) {
+ $item.find('a:not(.userLink)').prop('href', $item.data('confirmLink'));
+
+ if (!$.browser.mobile) {
+ var $markAsConfirmed = $('<a href="#" class="icon icon24 fa-check green notificationItemMarkAsConfirmed jsTooltip" title="' + WCF.Language.get('wcf.user.notification.markAsConfirmed') + '" />').prependTo($item.find('> div.box24 > .framed'));
+ $markAsConfirmed.click($.proxy(this._markAsConfirmed, this));
+ }
}
}).bind(this));
var $insertAfter = null;
$items.each((function(index, item) {
var $item = $(item);
+ var $isConfirmed = $item.data('isConfirmed');
if (!$.browser.msie) {
$item.addClass('notificationItemLink');
- $('<a href="' + $item.data('link') + '" />').appendTo($item);
+ $('<a href="' + ($isConfirmed ? $item.data('link') : $item.data('confirmLink')) + '" />').appendTo($item);
}
- if (!$.browser.mobile && !$item.data('isConfirmed')) {
- var $markAsConfirmed = $('<a href="#" class="icon icon24 fa-check green notificationItemMarkAsConfirmed jsTooltip" title="' + WCF.Language.get('wcf.user.notification.markAsConfirmed') + '" />').prependTo($item.find('> span.box24 > .framed'));
- $markAsConfirmed.click($.proxy(this._markAsConfirmed, this));
+ if (!$isConfirmed) {
+ $item.find('a:not(.userLink)').prop('href', $item.data('confirmLink'));
+
+ if (!$.browser.mobile) {
+ var $markAsConfirmed = $('<a href="#" class="icon icon24 fa-check green notificationItemMarkAsConfirmed jsTooltip" title="' + WCF.Language.get('wcf.user.notification.markAsConfirmed') + '" />').prependTo($item.find('> span.box24 > .framed'));
+ $markAsConfirmed.click($.proxy(this._markAsConfirmed, this));
+ }
}
if (!$item.data('isConfirmed')) {
--- /dev/null
+<?php
+namespace wcf\action;
+use wcf\data\object\type\ObjectTypeCache;
+use wcf\data\user\notification\event\UserNotificationEvent;
+use wcf\data\user\notification\UserNotification;
+use wcf\data\user\User;
+use wcf\data\user\UserProfile;
+use wcf\system\exception\IllegalLinkException;
+use wcf\system\exception\PermissionDeniedException;
+use wcf\system\user\notification\UserNotificationHandler;
+use wcf\system\WCF;
+use wcf\util\HeaderUtil;
+
+/**
+ * Marks target notification as confirmed and forwards to the notification URL.
+ *
+ * @author Alexander Ebert
+ * @copyright 2001-2014 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package com.woltlab.wcf
+ * @subpackage action
+ * @category Community Framework
+ */
+class NotificationConfirmAction extends AbstractAction {
+ /**
+ * @see \wcf\action\AbstractAction::$loginRequired
+ */
+ public $loginRequired = true;
+
+ /**
+ * user notification object
+ * @var \wcf\data\user\notification\UserNotification
+ */
+ public $notification = null;
+
+ /**
+ * user notification id
+ * @var integer
+ */
+ public $notificationID = 0;
+
+ /**
+ * @see \wcf\action\IAction::readParameters()
+ */
+ public function readParameters() {
+ parent::readParameters();
+
+ if (isset($_REQUEST['id'])) $this->notificationID = intval($_REQUEST['id']);
+
+ $this->notification = new UserNotification($this->notificationID);
+ if (!$this->notification->notificationID) {
+ throw new IllegalLinkException();
+ }
+
+ if ($this->notification->userID != WCF::getUser()->userID) {
+ throw new PermissionDeniedException();
+ }
+ }
+
+ /**
+ * @see \wcf\action\IAction::execute()
+ */
+ public function execute() {
+ parent::execute();
+
+ if (!$this->notification->confirmTime) {
+ UserNotificationHandler::getInstance()->markAsConfirmedByID($this->notification->notificationID);
+ }
+
+ $event = new UserNotificationEvent($this->notification->eventID);
+ $objectType = ObjectTypeCache::getInstance()->getObjectType($event->objectTypeID);
+ $objects = $objectType->getProcessor()->getObjectsByIDs(array($this->notification->objectID));
+
+ $className = $event->className;
+ $notificationEvent = new $className($event);
+ $notificationEvent->setObject(
+ $this->notification,
+ $objects[$this->notification->objectID],
+ $unknownAuthor = new UserProfile(new User(null, array('userID' => null, 'username' => WCF::getLanguage()->get('wcf.user.guest')))),
+ $this->notification->additionalData
+ );
+
+ HeaderUtil::redirect($notificationEvent->getLink());
+ exit;
+ }
+}