From fc8590a05ff3e31ce35d723964f329d57f32cb8d Mon Sep 17 00:00:00 2001 From: codemaster <39961806+codemaster115@users.noreply.github.com> Date: Mon, 11 Dec 2023 14:13:16 -0600 Subject: [PATCH] fix: no avatar for the first message in 1-1 chat (#18099) --- .../chat/messages/content/reactions/view.cljs | 1 - .../contexts/chat/messages/list/events.cljs | 26 ++++++++++++++----- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/status_im2/contexts/chat/messages/content/reactions/view.cljs b/src/status_im2/contexts/chat/messages/content/reactions/view.cljs index 3222b53d1d..91a1812f9d 100644 --- a/src/status_im2/contexts/chat/messages/content/reactions/view.cljs +++ b/src/status_im2/contexts/chat/messages/content/reactions/view.cljs @@ -2,7 +2,6 @@ (:require [quo.core :as quo] [quo.theme :as quo.theme] - [react-native.core :as rn] [status-im2.constants :as constants] [status-im2.contexts.chat.messages.drawers.view :as drawers] [utils.re-frame :as rf])) diff --git a/src/status_im2/contexts/chat/messages/list/events.cljs b/src/status_im2/contexts/chat/messages/list/events.cljs index 40e3ec0434..dc979f909a 100644 --- a/src/status_im2/contexts/chat/messages/list/events.cljs +++ b/src/status_im2/contexts/chat/messages/list/events.cljs @@ -5,6 +5,21 @@ [utils.re-frame :as rf] [utils.red-black-tree :as red-black-tree])) +(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 @@ -19,6 +34,7 @@ clock-value album-id message-type + content-type from outgoing whisper-timestamp @@ -28,12 +44,10 @@ (-> {:whisper-timestamp whisper-timestamp :from from :one-to-one? (= constants/message-type-one-to-one message-type) - :system-message? (boolean - (or - (= 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