Skip to content

Commit

Permalink
Fix list ID parsing in campaign UI
Browse files Browse the repository at this point in the history
  • Loading branch information
knadh committed Feb 9, 2020
1 parent a2d21a8 commit ec22170
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion frontend/src/Campaign.js
Original file line number Diff line number Diff line change
Expand Up @@ -381,20 +381,31 @@ 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) {
subLists.push(id)
}
}
}
}

if (this.record) {
this.props.pageTitle(record.name + " / Campaigns")
Expand Down

0 comments on commit ec22170

Please sign in to comment.