From 9aa89420c61cdd0ca3ac85d619b906b30f6c3668 Mon Sep 17 00:00:00 2001 From: Roman Volosovskyi Date: Tue, 14 Jun 2016 18:33:06 +0300 Subject: [PATCH] check empty :preview Former-commit-id: 3e60fd36a0f394cb218148cf4cb981e20763cf02 --- src/status_im/chat/views/message.cljs | 7 ++++--- src/status_im/models/messages.cljs | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/status_im/chat/views/message.cljs b/src/status_im/chat/views/message.cljs index 8f3ed5cb27..7bf6ee480e 100644 --- a/src/status_im/chat/views/message.cljs +++ b/src/status_im/chat/views/message.cljs @@ -63,9 +63,10 @@ [text {:style st/command-name} (str "!" (:name command))]]] ;; todo doesn't reflect design - [view (st/command-image-view command) - [image {:source {:uri (:icon command)} - :style st/command-image}]] + (when-let [icon (:icon command)] + [view (st/command-image-view command) + [image {:source {:uri icon} + :style st/command-image}]]) (if preview preview [text {:style st/command-text} diff --git a/src/status_im/models/messages.cljs b/src/status_im/models/messages.cljs index 0193217439..3d6611a887 100644 --- a/src/status_im/models/messages.cljs +++ b/src/status_im/models/messages.cljs @@ -56,8 +56,9 @@ (if (command-type? content-type) (-> message (update :content str-to-map) - (assoc :rendered-preview (generate-hiccup - (read-string preview))) + (assoc :rendered-preview (when preview + (generate-hiccup + (read-string preview)))) (dissoc :preview)) message)))))