add additional check to interceptor to only proceed during a pending revocation

This commit is contained in:
Rob Culliton 2018-05-08 09:41:30 -04:00
parent 773da8d074
commit eed60f8360
No known key found for this signature in database
GPG Key ID: 6FDEF60B3DC84D94
1 changed files with 19 additions and 16 deletions

View File

@ -43,14 +43,17 @@
:coeffects
:event
first)
pending-revocations (get-in context [:coeffects :db ::db/pending-revocations])
start-ob (get-in context [:coeffects :db :owner-bounties])
end-ob (get-in context [:effects :db :owner-bounties])]
;; proceed when the change isn't caused by page load
(when (not-empty start-ob)
(let [[only-before only-after both] (data/diff
(bounty-confirm-hashes start-ob)
(bounty-confirm-hashes end-ob))]
(when only-after ;; confirm hashes changed, now find out which ones
;; proceed when confirm hashes have changed and there is a pending revocation
(when (and only-after (not-empty pending-revocations))
(println "pending revocations are " pending-revocations)
(let [updated-bounties (->> end-ob
(filter-updated-bounties start-ob)
vals)]