From ec22170176903a8b2156b8a356d9bccda3064d41 Mon Sep 17 00:00:00 2001 From: Kailash Nadh Date: Mon, 3 Feb 2020 13:14:52 +0530 Subject: [PATCH] Fix list ID parsing in campaign UI --- frontend/src/Campaign.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/frontend/src/Campaign.js b/frontend/src/Campaign.js index fc0a7f2..57dcb7b 100644 --- a/frontend/src/Campaign.js +++ b/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")