From 30715a69e12b471944249d08c199e49a99f4725c Mon Sep 17 00:00:00 2001 From: flexsurfer Date: Thu, 16 May 2024 12:10:20 +0200 Subject: [PATCH] Avatars are missing in messages bridged from Discord to Status app (#19994) --- src/react_native/fast_image.cljs | 4 +- .../chat/messenger/messages/content/view.cljs | 45 +++++++++++-------- 2 files changed, 28 insertions(+), 21 deletions(-) diff --git a/src/react_native/fast_image.cljs b/src/react_native/fast_image.cljs index 995b3c332c..0f5b0a4fc2 100644 --- a/src/react_native/fast_image.cljs +++ b/src/react_native/fast_image.cljs @@ -15,7 +15,7 @@ [_] (let [loaded? (reagent/atom false) error? (reagent/atom false)] - (fn [{:keys [source] :as props}] + (fn [{:keys [source fallback-content] :as props}] [fast-image-class (merge props @@ -35,6 +35,6 @@ (when (or @error? (not @loaded?)) [placeholder (:style props) (if @error? - [rn/text "X"] + (or fallback-content [rn/text "X"]) (when-not @loaded? [rn/activity-indicator {:animating true}]))])]))) diff --git a/src/status_im/contexts/chat/messenger/messages/content/view.cljs b/src/status_im/contexts/chat/messenger/messages/content/view.cljs index cd5a811917..527c3cbfa0 100644 --- a/src/status_im/contexts/chat/messenger/messages/content/view.cljs +++ b/src/status_im/contexts/chat/messenger/messages/content/view.cljs @@ -126,25 +126,32 @@ (-> user-name (string/replace "" "") (string/replace "" "")))] - [rn/view - {:style {:flex-direction :row - :padding-horizontal 12 - :padding-top 4}} - [fast-image/fast-image - {:source {:uri user-avatar} - :style {:width 32 - :margin-top 4 - :border-radius 16 - :height 32}}] - [rn/view {:margin-left 8 :flex 1} - [quo/author - {:primary-name (str user-name) - :short-chat-key (str "Bridged from " bridge-name) - :time-str (datetime/timestamp->time timestamp)}] - [quo/text - {:size :paragraph-1 - :style {:line-height 22.75}} - content]]])) + (when (and user-name content) + [rn/view + {:style {:flex-direction :row + :padding-horizontal 12 + :padding-top 4}} + [fast-image/fast-image + {:source {:uri user-avatar} + :fallback-content [quo/user-avatar + {:full-name user-name + :ring? false + :online? false + :status-indicator? false + :size :small}] + :style {:width 32 + :margin-top 4 + :border-radius 16 + :height 32}}] + [rn/view {:margin-left 8 :flex 1} + [quo/author + {:primary-name (str user-name) + :short-chat-key (str "Bridged from " bridge-name) + :time-str (datetime/timestamp->time timestamp)}] + [quo/text + {:size :paragraph-1 + :style {:line-height 22.75}} + content]]]))) (declare on-long-press)