From aeb29e38b0be76ee2dac4ee4fc1cdc61de7a1c87 Mon Sep 17 00:00:00 2001 From: yenda Date: Mon, 11 Feb 2019 14:25:05 +0100 Subject: [PATCH] [fix] crash with creation and invitation to 1 letter group chat Signed-off-by: yenda --- src/status_im/ui/components/chat_icon/screen.cljs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/status_im/ui/components/chat_icon/screen.cljs b/src/status_im/ui/components/chat_icon/screen.cljs index 2fb8fc4795..367d9d7531 100644 --- a/src/status_im/ui/components/chat_icon/screen.cljs +++ b/src/status_im/ui/components/chat_icon/screen.cljs @@ -11,7 +11,15 @@ (when-not (string/blank? name) [react/view (:default-chat-icon styles) [react/text {:style (:default-chat-icon-text styles)} - (string/capitalize (second name))]])) + ;; TODO: for now we check if the first letter is a # + ;; which means it is most likely a public chat and + ;; use the second letter if that is the case + ;; a broader refactoring should clean up upstream params + ;; for default-chat-icon + (string/capitalize (if (and (= "#" (first name)) + (< 1 (count name))) + (second name) + (first name)))]])) (defn dapp-badge [{:keys [online-view-wrapper online-view online-dot-left online-dot-right]}] [react/view online-view-wrapper