Skip to content

Commit de94f1d

Browse files
committed
Import 'thread_broadcast' messages
These are like thread replies, but are also sent to the channel itself (for now we only render them on the thread.)
1 parent 86a7f46 commit de94f1d

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/clojurians_log/db/import.clj

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
;; about
2525
nil)
2626

27-
(defmethod event->tx nil [{:keys [ts text channel user thread_ts] :as message}]
27+
(defn message->tx [{:keys [ts text channel user thread_ts] :as message}]
2828
(when-not (= \D (first channel)) ;; ignore direct messages
2929
(let [inst (time-util/ts->inst ts)
3030
message #:message {:key (message-key message)
@@ -43,12 +43,20 @@
4343
:thread-inst (jt/to-java-date thread-inst)
4444
:day (time-util/format-inst-day thread-inst)}))))))
4545

46+
(defmethod event->tx nil [message]
47+
(message->tx message))
48+
4649
(defmethod event->tx "message_deleted" [{:keys [deleted_ts channel] :as message}]
4750
[:db.fn/retractEntity [:message/key (message-key {:channel channel :ts deleted_ts})]])
4851

4952
(defmethod event->tx "message_changed" [{:keys [message channel]}]
5053
(event->tx (assoc message :channel channel)))
5154

55+
;; Thread replies which are copied to the channel. For now we only include them
56+
;; in the thread.
57+
(defmethod event->tx "thread_broadcast" [message]
58+
(message->tx message))
59+
5260
(defn user->tx [{:keys [id name real_name is_admin is_owner profile]}]
5361
(let [{:keys [image_512 email first_name real_name_normalized image_48 image_192
5462
real_name image_72 image_24 avatar_hash team image_32 last_name

0 commit comments

Comments
 (0)