[fix] public chat icon when following link from private chat

- when following a link from a private chat, the public chat icons
was staying the same

Signed-off-by: yenda <eric@status.im>
This commit is contained in:
yenda 2019-02-07 09:50:44 +01:00
parent 14e887160a
commit f64111ceba
No known key found for this signature in database
GPG Key ID: 0095623C0069DCE6
2 changed files with 17 additions and 19 deletions

View File

@ -1,10 +1,11 @@
(ns status-im.ui.components.chat-icon.screen (ns status-im.ui.components.chat-icon.screen
(:require-macros [status-im.utils.views :refer [defview letsubs]])
(:require [clojure.string :as string] (:require [clojure.string :as string]
[status-im.ui.components.react :as react] [re-frame.core :as re-frame.core]
[status-im.ui.components.chat-icon.styles :as styles] [status-im.ui.components.chat-icon.styles :as styles]
[status-im.ui.screens.chat.photos :as photos] [status-im.ui.components.colors :as colors]
[status-im.ui.components.colors :as colors])) [status-im.ui.components.react :as react]
[status-im.ui.screens.chat.photos :as photos])
(:require-macros [status-im.utils.views :refer [defview letsubs]]))
(defn default-chat-icon [name styles] (defn default-chat-icon [name styles]
(when-not (string/blank? name) (when-not (string/blank? name)
@ -27,14 +28,15 @@
[react/view pending-outer-circle [react/view pending-outer-circle
[react/view pending-inner-circle]]]))) [react/view pending-inner-circle]]])))
(defview chat-icon-view [chat-id _group-chat name _online styles & [hide-dapp?]] (defn chat-icon-view
(letsubs [photo-path [:contacts/chat-photo chat-id] [chat-id _group-chat name _online styles & [hide-dapp?]]
dapp? [:get-in [:contacts/contacts chat-id :dapp?]]] (let [photo-path (re-frame.core/subscribe [:contacts/chat-photo chat-id])
dapp? (re-frame.core/subscribe [:get-in [:contacts/contacts chat-id :dapp?]])]
[react/view (:container styles) [react/view (:container styles)
(if-not (string/blank? photo-path) (if-not (string/blank? @photo-path)
[photos/photo photo-path styles] [photos/photo @photo-path styles]
[default-chat-icon name styles]) [default-chat-icon name styles])
(when (and dapp? (not hide-dapp?)) (when (and @dapp? (not hide-dapp?))
[dapp-badge styles]) [dapp-badge styles])
[pending-contact-badge chat-id styles]])) [pending-contact-badge chat-id styles]]))

View File

@ -1,15 +1,11 @@
(ns status-im.ui.screens.chat.toolbar-content (ns status-im.ui.screens.chat.toolbar-content
(:require-macros [status-im.utils.views :refer [defview letsubs]]) (:require [cljs-time.core :as t]
(:require [clojure.string :as string]
[cljs-time.core :as t]
[status-im.ui.components.react :as react]
[status-im.i18n :as i18n] [status-im.i18n :as i18n]
[status-im.ui.screens.chat.photos :as photos]
[status-im.ui.screens.chat.styles.main :as st]
[status-im.utils.datetime :as time]
[status-im.ui.components.chat-icon.screen :as chat-icon.screen] [status-im.ui.components.chat-icon.screen :as chat-icon.screen]
[status-im.ui.components.common.common :as components.common] [status-im.ui.components.react :as react]
[status-im.ui.components.styles :as common.styles])) [status-im.ui.screens.chat.styles.main :as st]
[status-im.utils.datetime :as time])
(:require-macros [status-im.utils.views :refer [defview letsubs]]))
(defn- online-text [contact chat-id] (defn- online-text [contact chat-id]
(if contact (if contact