summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2026-04-26 17:25:20 -0300
committerEuAndreh <eu@euandre.org>2026-04-26 17:25:20 -0300
commit6aeb8d478182f4ff90884bf2a7eb3a812ec38e17 (patch)
tree4dc0881ec526c9fa4024d3a974a0bb42b73e89d9 /src
parentREDACT: echo to sender, full nickmask prefix, FAIL format (diff)
downloadpapod-6aeb8d478182f4ff90884bf2a7eb3a812ec38e17.tar.gz
papod-6aeb8d478182f4ff90884bf2a7eb3a812ec38e17.tar.xz
Filter non-message events from CHATHISTORY without event-playback
When the client has the draft/event-playback capability we still emit JOIN/KICK/etc. in the historical batch; otherwise we now restrict the batch to user-message / user-edit / user-delete events, matching the chathistory spec.
Diffstat (limited to 'src')
-rw-r--r--src/papod.clj13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/papod.clj b/src/papod.clj
index 8624cfa..ec4265b 100644
--- a/src/papod.clj
+++ b/src/papod.clj
@@ -2454,7 +2454,18 @@
(let [limit (try
(Long/parseLong (last params))
(catch Exception _ 50))
- events (fetch-history db chan-eid 0 limit)
+ event-playback?
+ (contains? (or (:caps @client) #{})
+ "draft/event-playback")
+ all-events (fetch-history db chan-eid 0 limit)
+ events (if event-playback?
+ all-events
+ (filter
+ (fn [[_ type & _]]
+ (#{"user-message"
+ "user-edit"
+ "user-delete"} type))
+ all-events))
batch-id (str (java.util.UUID/randomUUID))]
(into
[(str "BATCH +" batch-id " chathistory "