Fixed marking all conversations as read via conversation list
authorAlexander Ebert <ebert@woltlab.com>
Sat, 20 Jun 2015 12:17:35 +0000 (14:17 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Sat, 20 Jun 2015 12:17:35 +0000 (14:17 +0200)
files/js/WCF.Conversation.js

index ffd2dcd490d88811a9b979b63870bf39f2afad59..9c69987373ef26086466b8848167be82c6bc7d4f 100644 (file)
@@ -1364,6 +1364,12 @@ WCF.User.Panel.Conversation = WCF.User.Panel.Abstract.extend({
                options.enableMarkAsRead = true;
                
                this._super($('#unreadConversations'), 'unreadConversations', options);
+               
+               WCF.System.Event.addListener('com.woltlab.wcf.conversation.userPanel', 'reset', (function() {
+                       this.resetItems();
+                       this.updateBadge(0);
+                       this._loadData = true;
+               }).bind(this));
        },
        
        /**
@@ -1543,21 +1549,7 @@ WCF.Conversation.MarkAllAsRead = Class.extend({
         */
        _success: function(data, textStatus, jqXHR) {
                // fix dropdown
-               var $dropdownMenu = WCF.Dropdown.getDropdownMenu('unreadConversations');
-               var $placeholder = $dropdownMenu.children('.jsDropdownPlaceholder').remove();
-               $dropdownMenu.data('count', 0);
-               $dropdownMenu.children().each(function(index, listItem) {
-                       var $listItem = $(listItem);
-                       if ($listItem.hasClass('dropdownDivider')) return false;
-                       
-                       $listItem.remove();
-               });
-               if (!$placeholder.length) {
-                       $('<li><span>' + WCF.Language.get('wcf.conversation.noMoreItems') + '</span></li>').prependTo($dropdownMenu);
-               }
-               
-               // remove badge
-               $('#unreadConversations .badge').remove();
+               WCF.System.Event.fireEvent('com.woltlab.wcf.conversation.userPanel', 'reset');
                
                // fix conversation list
                var $conversationList = $('.conversationList');