Skip to content

Commit

Permalink
Fix error when no ban option is selected
Browse files Browse the repository at this point in the history
  • Loading branch information
poeti8 committed Nov 28, 2018
1 parent 9b23aa8 commit 85f4813
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion server/db/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -445,10 +445,11 @@ exports.banUrl = async ({ id, domain, host, user }) => {
? 'MERGE (d:DOMAIN { name: $domain }) ON CREATE SET d.banned = true'
: '';
const hostQuery = host ? 'MERGE (h:HOST { name: $host }) ON CREATE SET h.banned = true' : '';
const withL = user || domain || host ? 'WITH l' : '';
await session.writeTransaction(tx =>
tx.run(
'MATCH (l:URL { id: $id }) WHERE NOT (l)-[:USES]->(:DOMAIN) ' +
`SET l.banned = true WITH l ${userQuery} ${domainQuery} ${hostQuery}`,
`SET l.banned = true ${withL} ${userQuery} ${domainQuery} ${hostQuery}`,
{
id,
domain,
Expand Down

0 comments on commit 85f4813

Please sign in to comment.