Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 42s
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
69 lines
1.8 KiB
Plaintext
69 lines
1.8 KiB
Plaintext
; Follow-up — viewer mute/block filtering. (feed-test name got expected)
|
|
|
|
(define
|
|
S
|
|
(feed/stream
|
|
(list
|
|
(feed/normalize {:actor "alice" :object "P1" :at 1 :tags (list "news")})
|
|
(feed/normalize {:actor "bob" :object "P2" :at 2 :tags (list "spam")})
|
|
(feed/normalize {:actor "alice" :object "P3" :at 3 :tags (list "cats")})
|
|
(feed/normalize {:actor "carol" :object "P4" :at 4 :tags (list "news" "spam")}))))
|
|
|
|
; ---------- mute actors ----------
|
|
|
|
(feed-test
|
|
"mute bob drops his post"
|
|
(map
|
|
(fn (a) (get a :object))
|
|
(feed/items (feed/mute-actors S (list "bob"))))
|
|
(list "P1" "P3" "P4"))
|
|
(feed-test
|
|
"mute alice drops two"
|
|
(feed/count (feed/mute-actors S (list "alice")))
|
|
2)
|
|
(feed-test
|
|
"mute nobody keeps all"
|
|
(feed/count (feed/mute-actors S (list)))
|
|
4)
|
|
|
|
; ---------- mute tags ----------
|
|
|
|
(feed-test
|
|
"mute spam tag drops two"
|
|
(map
|
|
(fn (a) (get a :object))
|
|
(feed/items (feed/mute-tags S (list "spam"))))
|
|
(list "P1" "P3"))
|
|
(feed-test
|
|
"mute news+cats leaves spam-only"
|
|
(map
|
|
(fn (a) (get a :object))
|
|
(feed/items (feed/mute-tags S (list "news" "cats"))))
|
|
(list "P2"))
|
|
|
|
; ---------- mute objects ----------
|
|
|
|
(feed-test
|
|
"mute object P3 (thread mute)"
|
|
(feed/count (feed/mute-objects S (list "P3")))
|
|
3)
|
|
|
|
; ---------- combined prefs ----------
|
|
|
|
(feed-test
|
|
"apply-prefs actors + tags"
|
|
(map
|
|
(fn (a) (get a :object))
|
|
(feed/items (feed/apply-prefs S {:mute-actors (list "bob") :mute-tags (list "cats")})))
|
|
(list "P1" "P4"))
|
|
(feed-test
|
|
"apply-prefs empty keeps all"
|
|
(feed/count (feed/apply-prefs S {}))
|
|
4)
|
|
(feed-test
|
|
"apply-prefs all three filters"
|
|
(map
|
|
(fn (a) (get a :object))
|
|
(feed/items (feed/apply-prefs S {:mute-objects (list "P3") :mute-actors (list "carol") :mute-tags (list "spam")})))
|
|
(list "P1"))
|