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:
parent
401f7d7383
commit
8d166a3a52
|
@ -91,7 +91,8 @@
|
||||||
(and (= constants/private-group-chat-type chat-type) ; it's a private group chat
|
(and (= constants/private-group-chat-type chat-type) ; it's a private group chat
|
||||||
(or (not (pos? joined)) ; we haven't joined
|
(or (not (pos? joined)) ; we haven't joined
|
||||||
(>= (quot joined 1000) synced-from))) ; the history goes before we 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
|
messages-with-gaps ; don't add an extra gap
|
||||||
(conj messages-with-gaps (last-gap chat-id synced-from)))))
|
(conj messages-with-gaps (last-gap chat-id synced-from)))))
|
||||||
|
|
||||||
|
@ -111,35 +112,30 @@
|
||||||
|
|
||||||
(defn albumize-messages
|
(defn albumize-messages
|
||||||
[messages]
|
[messages]
|
||||||
(get
|
(->> messages
|
||||||
(reduce
|
(reduce
|
||||||
(fn [{:keys [messages albums]} message]
|
(fn [{:keys [messages albums]} message]
|
||||||
(let [{:keys [album-id content quoted-message]} message
|
(let [{:keys [album-id content quoted-message]} message
|
||||||
{:keys [response-to]} content
|
{:keys [response-to]} content
|
||||||
albums (cond-> albums
|
albums (cond-> albums
|
||||||
album-id (update album-id conj message))
|
album-id
|
||||||
|
(update album-id conj message))
|
||||||
messages (if album-id
|
messages (if album-id
|
||||||
(conj
|
(conj (filterv #(not= album-id (:album-id %))
|
||||||
(filterv #(not= album-id (:album-id %))
|
|
||||||
messages)
|
messages)
|
||||||
|
(merge message
|
||||||
{:album (get albums album-id)
|
{:album (get albums album-id)
|
||||||
:album-id album-id
|
:album-id album-id
|
||||||
:albumize? (:albumize? message)
|
:content {:response-to
|
||||||
:message-id (:message-id message)
|
response-to}
|
||||||
: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}
|
|
||||||
:quoted-message quoted-message
|
:quoted-message quoted-message
|
||||||
:content-type constants/content-type-album})
|
:content-type
|
||||||
|
constants/content-type-album}))
|
||||||
(conj messages message))]
|
(conj messages message))]
|
||||||
{:messages messages
|
{:messages messages
|
||||||
:albums albums}))
|
:albums albums}))
|
||||||
{:messages []
|
{:messages []
|
||||||
:albums {}}
|
:albums {}})
|
||||||
messages)
|
|
||||||
:messages))
|
:messages))
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
|
|
|
@ -22,9 +22,6 @@
|
||||||
:album-id "abc"
|
:album-id "abc"
|
||||||
:albumize? true
|
:albumize? true
|
||||||
:message-id "0x444"
|
:message-id "0x444"
|
||||||
:deleted? nil
|
|
||||||
:deleted-for-me? nil
|
|
||||||
:deleted-by nil
|
|
||||||
:from :xyz
|
:from :xyz
|
||||||
:timestamp-str "14:00"
|
:timestamp-str "14:00"
|
||||||
:content-type constants/content-type-album}])
|
:content-type constants/content-type-album}])
|
||||||
|
|
Loading…
Reference in New Issue