Procházet zdrojové kódy

Fix list ID parsing in campaign UI

Kailash Nadh před 5 roky
rodič
revize
ec22170176
1 změnil soubory, kde provedl 12 přidání a 1 odebrání
  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) {
     if (this.props.isSingle && record.lists) {
       subLists = record.lists
       subLists = record.lists
         .map(v => {
         .map(v => {
+          // Exclude deleted lists.
           return v.id !== 0 ? v.id : null
           return v.id !== 0 ? v.id : null
         })
         })
         .filter(v => v !== null)
         .filter(v => v !== null)
     } else if (this.props.route.location.search) {
     } 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))
       const p = parseUrl.parse(this.props.route.location.search.substring(1))
       if (p.hasOwnProperty("list_id")) {
       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
         // eslint-disable-next-line radix
         const id = parseInt(p.list_id)
         const id = parseInt(p.list_id)
         if (id) {
         if (id) {
@@ -395,6 +405,7 @@ class TheFormDef extends React.PureComponent {
         }
         }
       }
       }
     }
     }
+    }
 
 
     if (this.record) {
     if (this.record) {
       this.props.pageTitle(record.name + " / Campaigns")
       this.props.pageTitle(record.name + " / Campaigns")