remove useless field in message subs
Signed-off-by: yenda <eric@status.im>
This commit is contained in:
parent
e93906c0d9
commit
75e20a0bbd
|
@ -226,7 +226,6 @@
|
||||||
last-in-group? (or (= :system-message message-type)
|
last-in-group? (or (= :system-message message-type)
|
||||||
(not= from (:from previous-message))
|
(not= from (:from previous-message))
|
||||||
(> (- (:timestamp previous-message) timestamp) group-ms))
|
(> (- (:timestamp previous-message) timestamp) group-ms))
|
||||||
same-direction? (= outgoing (:outgoing previous-message))
|
|
||||||
;; Have we seen an outgoing message already?
|
;; Have we seen an outgoing message already?
|
||||||
last-outgoing? (and (not last-outgoing-seen)
|
last-outgoing? (and (not last-outgoing-seen)
|
||||||
outgoing)
|
outgoing)
|
||||||
|
@ -237,7 +236,6 @@
|
||||||
last-in-group?)
|
last-in-group?)
|
||||||
new-message (assoc message
|
new-message (assoc message
|
||||||
:display-photo? (display-photo? message)
|
:display-photo? (display-photo? message)
|
||||||
:same-direction? same-direction?
|
|
||||||
:last-in-group? last-in-group?
|
:last-in-group? last-in-group?
|
||||||
:last-outgoing? last-outgoing?)]
|
:last-outgoing? last-outgoing?)]
|
||||||
{:stream (cond-> stream
|
{:stream (cond-> stream
|
||||||
|
@ -253,7 +251,7 @@
|
||||||
(defn messages-stream
|
(defn messages-stream
|
||||||
"Enhances the messages in message sequence interspersed with datemarks
|
"Enhances the messages in message sequence interspersed with datemarks
|
||||||
with derived stream context information, like:
|
with derived stream context information, like:
|
||||||
`:first-in-group?`, `last-in-group?`, `:same-direction?`, `:last?` and `:last-outgoing?` flags."
|
`:first-in-group?`, `last-in-group?`, `:last?` and `:last-outgoing?` flags."
|
||||||
[ordered-messages]
|
[ordered-messages]
|
||||||
(when (seq ordered-messages)
|
(when (seq ordered-messages)
|
||||||
(let [initial-message (first ordered-messages)
|
(let [initial-message (first ordered-messages)
|
||||||
|
|
|
@ -38,10 +38,6 @@
|
||||||
(is (not (:last-outgoing? actual-m1)))
|
(is (not (:last-outgoing? actual-m1)))
|
||||||
(is (:last-outgoing? actual-m2))
|
(is (:last-outgoing? actual-m2))
|
||||||
(is (not (:last-outgoing? actual-m3))))
|
(is (not (:last-outgoing? actual-m3))))
|
||||||
(testing "it marks the message with :same-direction? when from the same author"
|
|
||||||
(is (not (:same-direction? actual-m1)))
|
|
||||||
(is (not (:same-direction? actual-m2))
|
|
||||||
(is (:same-direction? actual-m3))))
|
|
||||||
(testing "it marks messages from the same author next to another with :first-in-group?"
|
(testing "it marks messages from the same author next to another with :first-in-group?"
|
||||||
(is (:first-in-group? actual-m1))
|
(is (:first-in-group? actual-m1))
|
||||||
(is (not (:first-in-group? actual-m2)))
|
(is (not (:first-in-group? actual-m2)))
|
||||||
|
@ -87,11 +83,6 @@
|
||||||
(is (not (:last-outgoing? actual-m2)))
|
(is (not (:last-outgoing? actual-m2)))
|
||||||
(is (not (:last-outgoing? actual-m3)))
|
(is (not (:last-outgoing? actual-m3)))
|
||||||
(is (not (:last-outgoing? actual-m4))))
|
(is (not (:last-outgoing? actual-m4))))
|
||||||
(testing "it resets :same-direction? after a datemark"
|
|
||||||
(is (not (:same-direction? actual-m1)))
|
|
||||||
(is (not (:same-direction? actual-m2))
|
|
||||||
(is (:same-direction? actual-m3)))
|
|
||||||
(is (:same-direction? actual-m4)))
|
|
||||||
(testing "it sets :first-in-group? after a datemark"
|
(testing "it sets :first-in-group? after a datemark"
|
||||||
(is (:first-in-group? actual-m1))
|
(is (:first-in-group? actual-m1))
|
||||||
(is (:first-in-group? actual-m4)))
|
(is (:first-in-group? actual-m4)))
|
||||||
|
|
Loading…
Reference in New Issue