From 75e20a0bbd40e6e8663d6e20d55d60a221b35801 Mon Sep 17 00:00:00 2001 From: yenda Date: Sun, 2 Jun 2019 11:19:57 +0200 Subject: [PATCH] remove useless field in message subs Signed-off-by: yenda --- src/status_im/chat/db.cljs | 4 +--- test/cljs/status_im/test/chat/db.cljs | 9 --------- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/src/status_im/chat/db.cljs b/src/status_im/chat/db.cljs index 03c1c3ba37..ee5e1fd3bc 100644 --- a/src/status_im/chat/db.cljs +++ b/src/status_im/chat/db.cljs @@ -226,7 +226,6 @@ last-in-group? (or (= :system-message message-type) (not= from (:from previous-message)) (> (- (:timestamp previous-message) timestamp) group-ms)) - same-direction? (= outgoing (:outgoing previous-message)) ;; Have we seen an outgoing message already? last-outgoing? (and (not last-outgoing-seen) outgoing) @@ -237,7 +236,6 @@ last-in-group?) new-message (assoc message :display-photo? (display-photo? message) - :same-direction? same-direction? :last-in-group? last-in-group? :last-outgoing? last-outgoing?)] {:stream (cond-> stream @@ -253,7 +251,7 @@ (defn messages-stream "Enhances the messages in message sequence interspersed with datemarks 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] (when (seq ordered-messages) (let [initial-message (first ordered-messages) diff --git a/test/cljs/status_im/test/chat/db.cljs b/test/cljs/status_im/test/chat/db.cljs index 8c2530eb20..ee13b72bcd 100644 --- a/test/cljs/status_im/test/chat/db.cljs +++ b/test/cljs/status_im/test/chat/db.cljs @@ -38,10 +38,6 @@ (is (not (:last-outgoing? actual-m1))) (is (:last-outgoing? actual-m2)) (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?" (is (:first-in-group? actual-m1)) (is (not (:first-in-group? actual-m2))) @@ -87,11 +83,6 @@ (is (not (:last-outgoing? actual-m2))) (is (not (:last-outgoing? actual-m3))) (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" (is (:first-in-group? actual-m1)) (is (:first-in-group? actual-m4)))