Avoid superfluous options when inline editing a poll
authorAlexander Ebert <ebert@woltlab.com>
Sat, 17 Mar 2018 22:51:18 +0000 (23:51 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Sat, 17 Mar 2018 22:51:18 +0000 (23:51 +0100)
wcfsetup/install/files/js/WCF.Poll.js

index 69b49bf665cefb959e8976157585ff6dd900b213..b37d25dbcce14e6d365aa57f31bda0e0bf28ca32 100644 (file)
@@ -94,8 +94,10 @@ WCF.Poll.Management = Class.extend({
                        this._createOption($option.optionValue, $option.optionID);
                }
                
-               // add empty option
-               this._createOption();
+               // add an empty option, unless it would exceed the limit
+               if (optionList.length < this._maxOptions) {
+                       this._createOption();
+               }
        },
        
        /**