Add members key to the chat-preview flow to show count of members on chat preview (#14274)
This commit is contained in:
parent
5e5ed0a11e
commit
3b69e5873e
|
@ -73,15 +73,15 @@
|
||||||
(dissoc :members)))
|
(dissoc :members)))
|
||||||
|
|
||||||
(defn <-rpc-js [^js chat]
|
(defn <-rpc-js [^js chat]
|
||||||
(-> {:name (.-name chat)
|
(-> {:name (.-name chat)
|
||||||
:description (.-description chat)
|
:description (.-description chat)
|
||||||
:color (.-color chat)
|
:color (.-color chat)
|
||||||
:emoji (.-emoji chat)
|
:emoji (.-emoji chat)
|
||||||
:timestamp (.-timestamp chat)
|
:timestamp (.-timestamp chat)
|
||||||
:alias (.-alias chat)
|
:alias (.-alias chat)
|
||||||
:identicon (.-identicon chat)
|
:identicon (.-identicon chat)
|
||||||
:muted (.-muted chat)
|
:muted (.-muted chat)
|
||||||
:joined (.-joined chat)
|
:joined (.-joined chat)
|
||||||
|
|
||||||
:chat-id (.-id chat)
|
:chat-id (.-id chat)
|
||||||
:community-id (.-communityId chat)
|
:community-id (.-communityId chat)
|
||||||
|
@ -98,7 +98,8 @@
|
||||||
:last-clock-value (.-lastClockValue chat)
|
:last-clock-value (.-lastClockValue chat)
|
||||||
:profile-public-key (.-profile chat)
|
:profile-public-key (.-profile chat)
|
||||||
:highlight (.-highlight chat)
|
:highlight (.-highlight chat)
|
||||||
:active (.-active chat)}
|
:active (.-active chat)
|
||||||
|
:members (types/js->clj (.-members chat))}
|
||||||
rpc->type
|
rpc->type
|
||||||
unmarshal-members))
|
unmarshal-members))
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,9 @@
|
||||||
(def members-added-type 3)
|
(def members-added-type 3)
|
||||||
|
|
||||||
(defn member?
|
(defn member?
|
||||||
[public-key {:keys [contacts]}]
|
[public-key {:keys [members contacts users]}]
|
||||||
(contains? contacts public-key))
|
(let [members-list (into #{} (concat (keys users) contacts (map #(:id %) members)))]
|
||||||
|
(contains? members-list public-key)))
|
||||||
|
|
||||||
(defn invited?
|
(defn invited?
|
||||||
[my-public-key {:keys [contacts]}]
|
[my-public-key {:keys [contacts]}]
|
||||||
|
|
|
@ -204,8 +204,11 @@
|
||||||
(first @(re-frame/subscribe [:contacts/contact-two-names-by-identity chat-id])))])
|
(first @(re-frame/subscribe [:contacts/contact-two-names-by-identity chat-id])))])
|
||||||
|
|
||||||
(defn home-list-item [home-item opts]
|
(defn home-list-item [home-item opts]
|
||||||
(let [{:keys [chat-id chat-name color group-chat muted emoji highlight edit? public? unviewed-messages-count contacts]} home-item
|
(let [{:keys [chat-id chat-name color group-chat muted emoji highlight edit? public? unviewed-messages-count contacts users members]} home-item
|
||||||
background-color (when highlight (colors/get-color :interactive-02))]
|
background-color (when highlight (colors/get-color :interactive-02))
|
||||||
|
group-members-public-keys (->> (concat (keys users) contacts (map #(:id %) members))
|
||||||
|
(into #{})
|
||||||
|
(remove nil?))]
|
||||||
[react/touchable-opacity (merge {:style {:height 64 :background-color background-color}} opts)
|
[react/touchable-opacity (merge {:style {:height 64 :background-color background-color}} opts)
|
||||||
[:<>
|
[:<>
|
||||||
(when (pos? unviewed-messages-count)
|
(when (pos? unviewed-messages-count)
|
||||||
|
@ -245,7 +248,7 @@
|
||||||
:margin-right 4}}]
|
:margin-right 4}}]
|
||||||
[quo2.text/text {:weight :medium
|
[quo2.text/text {:weight :medium
|
||||||
:style {:color (quo2.colors/theme-colors quo2.colors/neutral-50 quo2.colors/neutral-40)}}
|
:style {:color (quo2.colors/theme-colors quo2.colors/neutral-50 quo2.colors/neutral-40)}}
|
||||||
(i18n/label :t/members-count {:count (count contacts)})]]
|
(i18n/label :t/members-count {:count (count group-members-public-keys)})]]
|
||||||
[quo2.text/text {:monospace true
|
[quo2.text/text {:monospace true
|
||||||
:weight :medium
|
:weight :medium
|
||||||
:style {:color (quo2.colors/theme-colors quo2.colors/neutral-50 quo2.colors/neutral-40)}
|
:style {:color (quo2.colors/theme-colors quo2.colors/neutral-50 quo2.colors/neutral-40)}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
"_comment": "Instead use: scripts/update-status-go.sh <rev>",
|
"_comment": "Instead use: scripts/update-status-go.sh <rev>",
|
||||||
"owner": "status-im",
|
"owner": "status-im",
|
||||||
"repo": "status-go",
|
"repo": "status-go",
|
||||||
"version": "659ab120b66dca9521c93cbd8516582634059074",
|
"version": "bfab85f73bfa727db5b6e8078f9ce9ec191161ca",
|
||||||
"commit-sha1": "659ab120b66dca9521c93cbd8516582634059074",
|
"commit-sha1": "bfab85f73bfa727db5b6e8078f9ce9ec191161ca",
|
||||||
"src-sha256": "1x5pasyf4ivrw92pil4ljl6cfw3g6wn4drgxxszcdzih0pwzggx4"
|
"src-sha256": "184zcv531cgwdg7zr7ryav7w9qwd90jgqb9nmmhy4l2pmcm1mlc9"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue