Browse Source

Fix list ID parsing in campaign UI

Kailash Nadh 5 years ago
parent
commit
ec22170176
1 changed files with 12 additions and 1 deletions
  1. 12 1
      frontend/src/Campaign.js

+ 12 - 1
frontend/src/Campaign.js

@@ -381,13 +381,23 @@ class TheFormDef extends React.PureComponent {
     if (this.props.isSingle && record.lists) {
       subLists = record.lists
         .map(v => {
+          // Exclude deleted lists.
           return v.id !== 0 ? v.id : null
         })
         .filter(v => v !== null)
     } else if (this.props.route.location.search) {
-      // list_id in the query params.
+      // One or more list_id in the query params.
       const p = parseUrl.parse(this.props.route.location.search.substring(1))
       if (p.hasOwnProperty("list_id")) {
+        if(Array.isArray(p.list_id)) {
+          p.list_id.forEach(i => {
+            // eslint-disable-next-line radix
+            const id = parseInt(i)
+            if (id) {
+              subLists.push(id)
+            }
+          });
+        } else {
         // eslint-disable-next-line radix
         const id = parseInt(p.list_id)
         if (id) {
@@ -395,6 +405,7 @@ class TheFormDef extends React.PureComponent {
         }
       }
     }
+    }
 
     if (this.record) {
       this.props.pageTitle(record.name + " / Campaigns")