Improved loading behavior for user panel items
authorAlexander Ebert <ebert@woltlab.com>
Fri, 12 Dec 2014 12:46:10 +0000 (13:46 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Fri, 12 Dec 2014 12:46:10 +0000 (13:46 +0100)
wcfsetup/install/files/js/WCF.User.js

index f1ca4610424ff40c6ab7df4fa5ed2e11ecf6c5f9..f1e0b226313448ec24d8ada73ecb0452ccf0bfe6 100644 (file)
@@ -202,8 +202,21 @@ WCF.User.Panel.Abstract = Class.extend({
                        this._dropdown = this._initDropdown();
                }
                
-               if (this._dropdown.toggle() && this._loadData) {
-                       this._load();
+               if (this._dropdown.toggle()) {
+                       if (!this._loadData) {
+                               // check if there are outstanding items but there are no outstanding ones in the current list
+                               if (this._badge !== null) {
+                                       var $count = parseInt(this._badge.text()) || 0;
+                                       if ($count && !this._dropdown.getItemList().children('.interactiveDropdownItemOutstanding').length) {
+                                               this._loadData = true;
+                                       }
+                               }
+                       }
+                       
+                       if (this._loadData) {
+                               this._loadData = false;
+                               this._load();
+                       }
                }
                
                return false;