Add members key to the chat-preview flow to show count of members on chat preview (#14274)

This commit is contained in:
Ibrahem Khalil 2022-11-03 12:10:01 +03:00 committed by GitHub
parent 5e5ed0a11e
commit 3b69e5873e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 18 deletions

View File

@ -73,15 +73,15 @@
(dissoc :members)))
(defn <-rpc-js [^js chat]
(-> {:name (.-name chat)
:description (.-description chat)
:color (.-color chat)
:emoji (.-emoji chat)
:timestamp (.-timestamp chat)
:alias (.-alias chat)
:identicon (.-identicon chat)
:muted (.-muted chat)
:joined (.-joined chat)
(-> {:name (.-name chat)
:description (.-description chat)
:color (.-color chat)
:emoji (.-emoji chat)
:timestamp (.-timestamp chat)
:alias (.-alias chat)
:identicon (.-identicon chat)
:muted (.-muted chat)
:joined (.-joined chat)
:chat-id (.-id chat)
:community-id (.-communityId chat)
@ -98,7 +98,8 @@
:last-clock-value (.-lastClockValue chat)
:profile-public-key (.-profile chat)
:highlight (.-highlight chat)
:active (.-active chat)}
:active (.-active chat)
:members (types/js->clj (.-members chat))}
rpc->type
unmarshal-members))

View File

@ -3,8 +3,9 @@
(def members-added-type 3)
(defn member?
[public-key {:keys [contacts]}]
(contains? contacts public-key))
[public-key {:keys [members contacts users]}]
(let [members-list (into #{} (concat (keys users) contacts (map #(:id %) members)))]
(contains? members-list public-key)))
(defn invited?
[my-public-key {:keys [contacts]}]

View File

@ -204,8 +204,11 @@
(first @(re-frame/subscribe [:contacts/contact-two-names-by-identity chat-id])))])
(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
background-color (when highlight (colors/get-color :interactive-02))]
(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))
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)
[:<>
(when (pos? unviewed-messages-count)
@ -245,7 +248,7 @@
:margin-right 4}}]
[quo2.text/text {:weight :medium
: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
:weight :medium
:style {:color (quo2.colors/theme-colors quo2.colors/neutral-50 quo2.colors/neutral-40)}

View File

@ -3,7 +3,7 @@
"_comment": "Instead use: scripts/update-status-go.sh <rev>",
"owner": "status-im",
"repo": "status-go",
"version": "659ab120b66dca9521c93cbd8516582634059074",
"commit-sha1": "659ab120b66dca9521c93cbd8516582634059074",
"src-sha256": "1x5pasyf4ivrw92pil4ljl6cfw3g6wn4drgxxszcdzih0pwzggx4"
"version": "bfab85f73bfa727db5b6e8078f9ce9ec191161ca",
"commit-sha1": "bfab85f73bfa727db5b6e8078f9ce9ec191161ca",
"src-sha256": "184zcv531cgwdg7zr7ryav7w9qwd90jgqb9nmmhy4l2pmcm1mlc9"
}