[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))) (:parsed-text content)))
(defn quoted-message (defn quoted-message
[{:keys [message-id chat-id]} reply pin?] [{:keys [message-id chat-id]} pin?]
(let [{:keys [deleted? deleted-for-me?]} (get @(re-frame/subscribe [:chats/chat-messages chat-id]) (let [quoted-message (get @(re-frame/subscribe [:chats/chat-messages chat-id])
message-id) message-id)]
reply (assoc reply
:deleted? deleted?
:deleted-for-me? deleted-for-me?
:chat-id chat-id)]
[rn/view {:style (when-not pin? (style/quoted-message-container))} [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 (defn message-not-sent-text
[chat-id message-id] [chat-id message-id]

View File

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

View File

@ -121,7 +121,7 @@
:on-long-press #(on-long-press message-data context)} :on-long-press #(on-long-press message-data context)}
[rn/view {:style {:padding-vertical 8}} [rn/view {:style {:padding-vertical 8}}
(when (and (seq response-to) quoted-message) (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 [rn/view
{:style {:padding-horizontal 12 {:style {:padding-horizontal 12
:flex-direction :row}} :flex-direction :row}}

View File

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