Fix for sender's name, profile icon, chat key, timestamp being lost for messages that contain images (#15426)

* Fix for sender's name, profile icon, chat key, timestamp being lost for messages that contain images

Lint fix

Lint fix

* Lint fix

* Text fix
This commit is contained in:
Alexander 2023-03-23 10:10:07 +01:00 committed by GitHub
parent 401f7d7383
commit 8d166a3a52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 37 additions and 44 deletions

View File

@ -91,7 +91,8 @@
(and (= constants/private-group-chat-type chat-type) ; it's a private group chat
(or (not (pos? joined)) ; we haven't joined
(>= (quot joined 1000) synced-from))) ; the history goes before we joined
(:gap-ids (peek messages-with-gaps))) ; there's already a gap on top of the chat history
(:gap-ids (peek messages-with-gaps))) ; there's already a gap on top of the chat
; history
messages-with-gaps ; don't add an extra gap
(conj messages-with-gaps (last-gap chat-id synced-from)))))
@ -111,35 +112,30 @@
(defn albumize-messages
[messages]
(get
(->> messages
(reduce
(fn [{:keys [messages albums]} message]
(let [{:keys [album-id content quoted-message]} message
{:keys [response-to]} content
albums (cond-> albums
album-id (update album-id conj message))
album-id
(update album-id conj message))
messages (if album-id
(conj
(filterv #(not= album-id (:album-id %))
(conj (filterv #(not= album-id (:album-id %))
messages)
(merge message
{:album (get albums album-id)
:album-id album-id
:albumize? (:albumize? message)
:message-id (:message-id message)
:deleted? (:deleted? message)
:deleted-for-me? (:deleted-for-me? message)
:deleted-by (:deleted-by message)
:from (:from message)
:timestamp-str (:timestamp-str message)
:content {:response-to response-to}
:content {:response-to
response-to}
:quoted-message quoted-message
:content-type constants/content-type-album})
:content-type
constants/content-type-album}))
(conj messages message))]
{:messages messages
:albums albums}))
{:messages []
:albums {}}
messages)
:albums {}})
:messages))
(re-frame/reg-sub

View File

@ -22,9 +22,6 @@
:album-id "abc"
:albumize? true
:message-id "0x444"
:deleted? nil
:deleted-for-me? nil
:deleted-by nil
:from :xyz
:timestamp-str "14:00"
:content-type constants/content-type-album}])