[19576] Fix group avatar not showing group picture (#19723)

This commit is contained in:
Ibrahem Khalil 2024-04-19 12:24:03 +02:00 committed by GitHub
parent 1f967c6aa1
commit 8353c65602
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 28 additions and 2 deletions

View File

@ -234,7 +234,9 @@
online? (rf/sub [:visibility-status-updates/online? chat-id])
contact (when-not group-chat
(rf/sub [:contacts/contact-by-address chat-id]))
photo-path (rf/sub [:chats/photo-path chat-id])
photo-path (if group-chat
(rf/sub [:chats/group-chat-image chat-id])
(rf/sub [:chats/photo-path chat-id]))
top-margin (+ (safe-area/get-top)
messages.constants/top-bar-height
messages.constants/header-container-top-margin

View File

@ -34,7 +34,9 @@
(str "# " chat-name)
:else (str emoji chat-name))
online? (when-not group-chat (rf/sub [:visibility-status-updates/online? chat-id]))
photo-path (when-not group-chat (rf/sub [:chats/photo-path chat-id]))
photo-path (if group-chat
(rf/sub [:chats/group-chat-image chat-id])
(rf/sub [:chats/photo-path chat-id]))
header-opacity (worklets/navigation-header-opacity
distance-from-list-top
all-loaded?

View File

@ -367,3 +367,10 @@
:camera-roll/total-photos-count-ios
(fn [{:keys [camera-roll/ios-images-count]}]
ios-images-count))
(re-frame/reg-sub
:chats/group-chat-image
(fn [[_ chat-id]]
(re-frame/subscribe [:chats/chat chat-id]))
:->
:image)

View File

@ -177,3 +177,18 @@
(is (= :army (:color result)))
(is (= "test" (:chat-name result)))
(is (= "🍑" (:emoji result)))))))
(h/deftest-sub :chats/group-chat-image
[sub-name]
(testing "returns picture for group"
(let [image-data {:uri "data:image/png1234"}
chats {chat-id (assoc community-chat
:color :army
:emoji "🍑"
:chat-name "test"
:image image-data)}]
(swap! rf-db/app-db assoc
:chats
chats)
(let [result (rf/sub [sub-name chat-id])]
(= image-data result)))))