Streamful

Check-in [effb2fd9bf]
Login

Check-in [effb2fd9bf]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Make show-thread a bit more configurable
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: effb2fd9bfb5ae35c80e72af8753db7c997e7d250dd7dbb9895c181d2e1adbfb
User & Date: scstarkey 2025-03-13 13:56:03
Context
2025-03-14
12:43
Much refactoring of cleanup processes and backing in test coverage check-in: 88cb69c20c user: scstarkey tags: trunk
2025-03-13
13:56
Make show-thread a bit more configurable check-in: effb2fd9bf user: scstarkey tags: trunk
13:53
A few more comments check-in: a79cd2aea0 user: scstarkey tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to test/streamful/manual_testing.clj.

108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124

125

126
127
128
129
130
131
132
        (map
          (fn [{:strs [id agg] {:strs [c k] {:strs [params sid]} "m"} "m"
                :as _raw}]
            {:sid sid, :id id, :cmd c, :params params, :agg agg, :k k
             ;;:raw _raw
             }) x)))

(defn- show-thread [c msg-id]
  (let [msg (-> (client/get-messages-by-sha c [msg-id]) recombinate first)
        msg-ids ((:agg msg) "thm")

        thread-messages
        (concat [msg]
                (->> msg-ids (client/get-messages-by-sha c) recombinate))]
    #_(clojure.pprint/pprint thread-messages)
    (->> thread-messages
         (map (fn [{:keys [sid k] {:strs [t]} :params}]

                {:sid sid, :from (subs k 0 8), :msg t}))

         clojure.pprint/print-table)))

(comment
  (log/set-min-level! :error)

  (def c (client/new-client "localhost" 1100 server-pk 1000))








|








|
>
|
>







108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
        (map
          (fn [{:strs [id agg] {:strs [c k] {:strs [params sid]} "m"} "m"
                :as _raw}]
            {:sid sid, :id id, :cmd c, :params params, :agg agg, :k k
             ;;:raw _raw
             }) x)))

(defn- show-thread [c msg-id & ks-to-include]
  (let [msg (-> (client/get-messages-by-sha c [msg-id]) recombinate first)
        msg-ids ((:agg msg) "thm")

        thread-messages
        (concat [msg]
                (->> msg-ids (client/get-messages-by-sha c) recombinate))]
    #_(clojure.pprint/pprint thread-messages)
    (->> thread-messages
         (map (fn [{:keys [sid k id] {:strs [t]} :params}]
                (select-keys
                  {:sid sid, :from (subs k 0 8), :id id, :msg t}
                  ks-to-include)))
         clojure.pprint/print-table)))

(comment
  (log/set-min-level! :error)

  (def c (client/new-client "localhost" 1100 server-pk 1000))

186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201


202
203
204
205
206
207
208
          (map
            (fn [{:strs [id] {:strs [c] {:strs [params]} "m"} "m"}]
              {:id id, :cmd c, :params params}) x)
          (filter (fn [{:keys [cmd]}] (= "put" cmd)) x)
          (first x)
          (:id x)))

  (show-thread c msg-id1)

  ;->
  ;|     :sid |    :from |              :msg |
  ;|----------+----------+-------------------|
  ;|     root | v+aycFhS |     hello, world! |
  ;|   public | v+aycFhS |    hello, to you! |
  ;| personal | v+aycFhS |   how are things? |
  ;|   public | v+aycFhS | things are great! |



  (client/submit-message c {:sid "public"
                            :t "hello, to you!"
                            :rid msg-id1
                            :tid msg-id1})

  (client/submit-message c {:sid "personal"







|








>
>







188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
          (map
            (fn [{:strs [id] {:strs [c] {:strs [params]} "m"} "m"}]
              {:id id, :cmd c, :params params}) x)
          (filter (fn [{:keys [cmd]}] (= "put" cmd)) x)
          (first x)
          (:id x)))

  (show-thread c msg-id1 :sid :from :msg)

  ;->
  ;|     :sid |    :from |              :msg |
  ;|----------+----------+-------------------|
  ;|     root | v+aycFhS |     hello, world! |
  ;|   public | v+aycFhS |    hello, to you! |
  ;| personal | v+aycFhS |   how are things? |
  ;|   public | v+aycFhS | things are great! |

  (show-thread c msg-id1 :sid :from :id :msg)

  (client/submit-message c {:sid "public"
                            :t "hello, to you!"
                            :rid msg-id1
                            :tid msg-id1})

  (client/submit-message c {:sid "personal"