2 files changed, 18 insertions(+), 11 deletions(-)

M HOWTO.org
M wispwot/server.w
M HOWTO.org +8 -1
@@ 274,7 274,7 @@ GET http://127.0.0.1:4280/score/ownkey/0
 #+end_src
 
 #+RESULTS:
-: 3
+: 2
 
 But it cannot impact the score of IDs that are closer in the
 trust-graph (cannot cause an ancestor to become distrusted).

          
@@ 321,6 321,13 @@ GET http://127.0.0.1:4280/subscriptions/
 #+end_src
 
 #+RESULTS:
+: ONEOTHERID
+: 
+: long\nlong\nlinebreaks
+: 
+: BADID
+: 
+: OTHERID
 
 
 When a subscription yields an update, put it with metadata; wispwot

          
M wispwot/server.w +10 -10
@@ 604,12 604,12 @@ define : handle-webhook-event wotstate e
             ;; node which gets unfollowed does not get reported.
             define trust
               cond
-                (equal? event "block.created") : +-max-inc -50 previous-trust
-                (equal? event "follow.created") : +-min-inc 30 previous-trust
-                (equal? event "mute.created") : +-max-inc -1 previous-trust
-                (equal? event "block.removed") : +-max-0 50 previous-trust
-                (equal? event "follow.removed") : +-min-0 -30 previous-trust
-                (equal? event "mute.removed") : +-max-0 1 previous-trust
+                (equal? event "block.created") : +-max-inc -50 : or previous-trust 0
+                (equal? event "follow.created") : +-min-inc 30 : or previous-trust 0
+                (equal? event "mute.created") : +-max-inc -1 : or previous-trust 0
+                (equal? event "block.removed") : +-max-0 50 : or previous-trust 0
+                (equal? event "follow.removed") : +-min-0 -30 : or previous-trust 0
+                (equal? event "mute.removed") : +-max-0 1 : or previous-trust 0
                 else previous-trust
             add-trust-edge! wotstate ownid trustee trust
             update-wotcache-from-wotstate! wotstate ownid

          
@@ 622,14 622,14 @@ define : handle-webhook-action wotstate 
         define otherid : assoc-ref json-body "sender"
         ;; FIXME: ownid does not exist yet! ⇒ key = false
         define ownkey : id->key wotstate : id->string ownid
-        define ownidx : key->index ownkey
+        define ownidx : and=> ownkey key->index
         define otherkey : id->key wotstate : id->string otherid
         log-format "ownid ~a ownkey ~a otherid ~e otherkey ~a\n" ownid ownkey otherid otherkey
-        define otheridx : key->index otherkey
+        define otheridx : and=> otherkey key->index
         define scores
             wotstate-scores wotstate
-        define score : vector-ref scores otheridx
-        if {score >= 0} 
+        define score : and=> otheridx : cut vector-ref scores <>
+        if : or (not score) {score >= 0} 
             . "{\"notOk\": false}"
             . "{\"notOk\": true}"