unwatch wasn't unwatching when webhooks not supplied

This commit is contained in:
kexkey
2020-11-24 01:10:13 -05:00
parent 0b1fd6e0d7
commit fe3471b3c6
2 changed files with 12 additions and 2 deletions

View File

@@ -20,7 +20,17 @@ unwatchrequest() {
data="{\"event\":\"unwatch\",\"id\":${watchid}}"
else
sql "UPDATE watching SET watching=0 WHERE address='${address}' AND callback0conf=${unconfirmedCallbackURL} AND callback1conf=${confirmedCallbackURL}"
local cb0_where=
local cb1_where=
if [ "${unconfirmedCallbackURL}" != "null" ]; then
cb0_where=" AND callback0conf='${unconfirmedCallbackURL}'"
fi
if [ "${confirmedCallbackURL}" != "null" ]; then
cb1_where=" AND callback1conf='${confirmedCallbackURL}'"
fi
sql "UPDATE watching SET watching=0 WHERE address='${address}'${cb0_where}${cb1_where}"
returncode=$?
trace_rc ${returncode}