瀏覽代碼

Fix multiselect toggle logic

If every element already has the label/member, we do not need to add it
but it should be removed and if every element does not have the element,
we should add it.
Alexander Sulfrian 10 年之前
父節點
當前提交
6277bd2a90
共有 1 個文件被更改,包括 4 次插入4 次删除
  1. 4 4
      client/components/sidebar/sidebarFilters.js

+ 4 - 4
client/components/sidebar/sidebarFilters.js

@@ -69,9 +69,9 @@ BlazeComponent.extendComponent({
         const mappedSelection = this.mapSelection('label', labelId);
 
         if (_.every(mappedSelection)) {
-          mutateSelectedCards('addLabel', labelId);
-        } else if (_.every(mappedSelection, (bool) => !bool)) {
           mutateSelectedCards('removeLabel', labelId);
+        } else if (_.every(mappedSelection, (bool) => !bool)) {
+          mutateSelectedCards('addLabel', labelId);
         } else {
           const popup = Popup.open('disambiguateMultiLabel');
           // XXX We need to have a better integration between the popup and the
@@ -83,9 +83,9 @@ BlazeComponent.extendComponent({
         const memberId = this.currentData()._id;
         const mappedSelection = this.mapSelection('member', memberId);
         if (_.every(mappedSelection)) {
-          mutateSelectedCards('assignMember', memberId);
-        } else if (_.every(mappedSelection, (bool) => !bool)) {
           mutateSelectedCards('unassignMember', memberId);
+        } else if (_.every(mappedSelection, (bool) => !bool)) {
+          mutateSelectedCards('assignMember', memberId);
         } else {
           const popup = Popup.open('disambiguateMultiMember');
           // XXX We need to have a better integration between the popup and the