Fixed notifications
authorAlexander Ebert <ebert@woltlab.com>
Tue, 23 Jul 2013 13:27:11 +0000 (15:27 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Tue, 23 Jul 2013 13:27:11 +0000 (15:27 +0200)
wcfsetup/install/files/js/WCF.User.js

index 657a8a94af7ca010662d294a78795254022675f0..33d1acd3ab5fab3e8d971b081105ccb108a44d73 100644 (file)
@@ -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 '<a>' + oldHTML + '</a>';
-                       }).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];