disqus / gargoyle

Feature switches in Django
http://engineering.disqus.com
Apache License 2.0
746 stars 112 forks source link

Bug with SELECTIVE switch. #14

Closed mscheibe closed 13 years ago

mscheibe commented 13 years ago

When a SELECTIVE switch is freshly created and has no conditions, it is treated as active. However, once conditions are added and then removed, leaving no conditions, instead of the value being {}, it might be stored as something like this: {"auth.user": {"is_superuser": [], "is_staff": []}}. This will then effectively be treated as a disabled switch, even though there are no conditions. This seems like a bug and is confusing, as these both look the same on the dashboard. To make it consistent removing conditions actually removes them from this JSON object too now.

Also, fixed an issue with the javascript where it wouldn't show the correct "(Active for everyone)" label in this scenario as empty object in JavaScript is truthy ie. !!{} === true

dcramer commented 13 years ago

It brings tears to my eyes everytime someone sends a pull request with tests :D

mscheibe commented 13 years ago

tests are just good pull request etiquette :)