From 418dd584af1efd39dc285117a935be60c46f67e3 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Tue, 23 Jul 2013 15:27:11 +0200 Subject: [PATCH] Fixed notifications --- wcfsetup/install/files/js/WCF.User.js | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/wcfsetup/install/files/js/WCF.User.js b/wcfsetup/install/files/js/WCF.User.js index 657a8a94af..33d1acd3ab 100644 --- a/wcfsetup/install/files/js/WCF.User.js +++ b/wcfsetup/install/files/js/WCF.User.js @@ -1380,7 +1380,7 @@ WCF.Notification.List = Class.extend({ $container.find('.jsMarkAsConfirmed').data('notificationID', $container.data('notificationID')).click($.proxy(this._click, this)); $container.find('p').html(function(index, oldHTML) { return '' + oldHTML + ''; - }).children('a').click($.proxy(this._click, this)); + }).children('a').data('notificationID', $container.data('notificationID')).click($.proxy(this._clickLink, this)); }, this)); this._badge = $('.jsNotificationsBadge:eq(0)'); @@ -1392,19 +1392,27 @@ WCF.Notification.List = Class.extend({ $('.contentNavigation .jsMarkAllAsConfirmed').click($.proxy(this._markAllAsConfirmed, this)); }, + /** + * Handles clicks on the text link. + * + * @param object event + */ + _clickLink: function(event) { + this._items[$(event.currentTarget).data('notificationID')].data('redirect', true); + this._click(event); + }, + /** * Handles button actions. * * @param object event */ _click: function(event) { - var $notificationID = $(event.currentTarget).data('notificationID'); - this._proxy.setOption('data', { actionName: 'markAsConfirmed', className: 'wcf\\data\\user\\notification\\UserNotificationAction', parameters: { - notificationID: $notificationID + notificationID: $(event.currentTarget).data('notificationID') } }); this._proxy.sendRequest(); @@ -1439,6 +1447,12 @@ WCF.Notification.List = Class.extend({ break; case 'markAsConfirmed': + var $item = this._items[data.returnValues.notificationID]; + if ($item.data('redirect')) { + window.location = $item.data('link'); + return; + } + this._items[data.returnValues.notificationID].remove(); delete this._items[data.returnValues.notificationID]; -- 2.20.1