Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
codemaster115 committed Dec 6, 2023
1 parent b2d57d6 commit 8153937
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/status_im2/contexts/chat/messages/list/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,21 @@
[utils.re-frame :as rf]
[utils.red-black-tree :as red-black-tree]))

(def is-system-message?
(def is-system-message-content-type?
#{constants/content-type-system-text
constants/content-type-community
constants/content-type-system-message-mutual-event-accepted
constants/content-type-system-message-mutual-event-removed
constants/content-type-system-message-mutual-event-sent
constants/content-type-system-pinned-message})

(defn is-system-message?
[content-type message-type]
(or
(is-system-message-content-type? content-type)
(= constants/message-type-private-group-system-message
message-type)))

(defn- add-datemark
[{:keys [whisper-timestamp] :as msg}]
;;NOTE(performance) this is slow
Expand All @@ -37,13 +44,10 @@
(-> {:whisper-timestamp whisper-timestamp
:from from
:one-to-one? (= constants/message-type-one-to-one message-type)
:system-message? (boolean
(or
(is-system-message? content-type)
(= constants/message-type-private-group-system-message
message-type)
deleted?
deleted-for-me?))
:system-message? (or
(is-system-message? content-type message-type)
deleted?
deleted-for-me?)
:clock-value clock-value
:type :message
:message-id message-id
Expand Down

0 comments on commit 8153937

Please sign in to comment.