mirror of
https://github.com/status-im/status-mobile.git
synced 2025-01-13 18:25:45 +00:00
[Fixes: #9492] Consider system messages always in their own group
System messages should always display the user picture, and should never be grouped. Signed-off-by: Andrea Maria Piana <andrea.maria.piana@gmail.com>
This commit is contained in:
parent
7d1812cc94
commit
ddbfc78e08
@ -37,6 +37,8 @@
|
||||
We check the time, and the author"
|
||||
[a b]
|
||||
(and
|
||||
(not (:system-message? a))
|
||||
(not (:system-message? b))
|
||||
(= (:from a) (:from b))
|
||||
(<= (js/Math.abs (- (:whisper-timestamp a) (:whisper-timestamp b))) group-ms)))
|
||||
|
||||
|
@ -168,3 +168,32 @@
|
||||
(s/->seq)
|
||||
(nth 2)
|
||||
:message-id)))))))
|
||||
|
||||
(deftest same-group-test
|
||||
(testing "two messages from the same author and close together"
|
||||
(is (s/same-group? {:whisper-timestamp 1
|
||||
:from "1"}
|
||||
{:whisper-timestamp 2
|
||||
:from "1"})))
|
||||
(testing "two messages from the same author, close together, first system-message"
|
||||
(is (not (s/same-group? {:whisper-timestamp 1
|
||||
:system-message? true
|
||||
:from "1"}
|
||||
{:whisper-timestamp 2
|
||||
:from "1"}))))
|
||||
(testing "two messages from the same author, close together, second system-message"
|
||||
(is (not (s/same-group? {:whisper-timestamp 1
|
||||
:from "1"}
|
||||
{:whisper-timestamp 2
|
||||
:system-message? true
|
||||
:from "1"}))))
|
||||
(testing "two messages from the same author and far apart"
|
||||
(is (not (s/same-group? {:whisper-timestamp 1
|
||||
:from "1"}
|
||||
{:whisper-timestamp 2000000
|
||||
:from "1"}))))
|
||||
(testing "two messages not from the same author and close together"
|
||||
(is (not (s/same-group? {:whisper-timestamp 1
|
||||
:from "2"}
|
||||
{:whisper-timestamp 2
|
||||
:from "1"})))))
|
||||
|
Loading…
x
Reference in New Issue
Block a user