[15127] Make reply and pinned banner react on edit (#15189)

This commit is contained in:
Ibrahem Khalil 2023-03-02 15:03:30 +02:00 committed by GitHub
parent 8f75874868
commit 01c058fecc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 14 deletions

View File

@ -128,15 +128,11 @@
(:parsed-text content)))
(defn quoted-message
[{:keys [message-id chat-id]} reply pin?]
(let [{:keys [deleted? deleted-for-me?]} (get @(re-frame/subscribe [:chats/chat-messages chat-id])
message-id)
reply (assoc reply
:deleted? deleted?
:deleted-for-me? deleted-for-me?
:chat-id chat-id)]
[{:keys [message-id chat-id]} pin?]
(let [quoted-message (get @(re-frame/subscribe [:chats/chat-messages chat-id])
message-id)]
[rn/view {:style (when-not pin? (style/quoted-message-container))}
[components.reply/reply-message reply false pin?]]))
[components.reply/reply-message quoted-message false pin?]]))
(defn message-not-sent-text
[chat-id message-id]

View File

@ -59,5 +59,4 @@
(old-style/message-timestamp-text))
:accessibility-label :message-timestamp}
timestamp-str]]
[old-message/quoted-message {:message-id response-to :chat-id chat-id} (:quoted-message message)
true]]]))
[old-message/quoted-message {:message-id response-to :chat-id chat-id} true]]]))

View File

@ -121,7 +121,7 @@
:on-long-press #(on-long-press message-data context)}
[rn/view {:style {:padding-vertical 8}}
(when (and (seq response-to) quoted-message)
[old-message/quoted-message {:message-id response-to :chat-id chat-id} quoted-message])
[old-message/quoted-message {:message-id response-to :chat-id chat-id}])
[rn/view
{:style {:padding-horizontal 12
:flex-direction :row}}

View File

@ -5,9 +5,9 @@
(defn banner
[chat-id]
(let [pinned-messages (rf/sub [:chats/pinned-sorted-list
chat-id])
latest-pinned-message (last pinned-messages)
(let [pinned-messages (rf/sub [:chats/pinned-sorted-list chat-id])
latest-pinned-message-id (-> pinned-messages last :message-id)
latest-pinned-message (get (rf/sub [:chats/chat-messages chat-id]) latest-pinned-message-id)
latest-pin-text (get-in latest-pinned-message [:content :text])
{:keys [deleted? deleted-for-me?]} latest-pinned-message
pins-count (count pinned-messages)