Edit message issues (#14638)
This commit is contained in:
parent
915b8ebd9a
commit
77629fa7e1
|
@ -64,9 +64,14 @@
|
||||||
(i18n/label :t/message-deleted)]])
|
(i18n/label :t/message-deleted)]])
|
||||||
|
|
||||||
(defn reply-message
|
(defn reply-message
|
||||||
[{:keys [from identicon content-type contentType parsed-text content deleted? deleted-for-me?]}
|
[{:keys [chat-id id]}
|
||||||
in-chat-input? pin?]
|
in-chat-input? pin?]
|
||||||
(let [contact-name (rf/sub [:contacts/contact-name-by-identity from])
|
(let [reply-content-sub (-> [:chats/chat-messages chat-id]
|
||||||
|
rf/sub
|
||||||
|
(get id))
|
||||||
|
{:keys [from identicon content-type contentType parsed-text content deleted? deleted-for-me?]}
|
||||||
|
reply-content-sub
|
||||||
|
contact-name (rf/sub [:contacts/contact-name-by-identity from])
|
||||||
current-public-key (rf/sub [:multiaccount/public-key])
|
current-public-key (rf/sub [:multiaccount/public-key])
|
||||||
content-type (or content-type contentType)]
|
content-type (or content-type contentType)]
|
||||||
[rn/view
|
[rn/view
|
||||||
|
|
|
@ -250,21 +250,27 @@
|
||||||
max-height
|
max-height
|
||||||
set-bg-opacity)]
|
set-bg-opacity)]
|
||||||
(quo.react/effect!
|
(quo.react/effect!
|
||||||
#(do
|
(fn []
|
||||||
|
(let [input-text (-> [:chat/inputs]
|
||||||
|
rf/sub
|
||||||
|
(get chat-id)
|
||||||
|
:input-text)
|
||||||
|
edited? (not= input-text (-> edit :content :text))]
|
||||||
(when (and @keyboard-was-shown? (not keyboard-shown))
|
(when (and @keyboard-was-shown? (not keyboard-shown))
|
||||||
(swap! context assoc :state :min)
|
(swap! context assoc :state :min)
|
||||||
(set-bg-opacity 0))
|
(set-bg-opacity 0))
|
||||||
(when (and blank-composer? (not (seq images)) (not edit))
|
(when (and blank-composer? (empty? images) (not edit))
|
||||||
(clean-and-minimize-composer-fn false))
|
(clean-and-minimize-composer-fn false))
|
||||||
(when (seq images)
|
(if (or (seq images) (and (not blank-composer?) edited?))
|
||||||
(input/show-send refs))
|
(input/show-send refs)
|
||||||
|
(input/hide-send refs))
|
||||||
(reset! keyboard-was-shown? keyboard-shown)
|
(reset! keyboard-was-shown? keyboard-shown)
|
||||||
(if (#{:max :custom-chat-unavailable} (:state @context))
|
(if (#{:max :custom-chat-unavailable} (:state @context))
|
||||||
(set-bg-opacity 1)
|
(set-bg-opacity 1)
|
||||||
(set-bg-opacity 0))
|
(set-bg-opacity 0))
|
||||||
(reanimated/set-shared-value translate-y (reanimated/with-timing (- y)))
|
(reanimated/set-shared-value translate-y (reanimated/with-timing (- y)))
|
||||||
(reanimated/set-shared-value shared-height
|
(reanimated/set-shared-value shared-height
|
||||||
(reanimated/with-timing (min y max-height)))))
|
(reanimated/with-timing (min y max-height))))))
|
||||||
[reanimated/view
|
[reanimated/view
|
||||||
{:style (reanimated/apply-animations-to-style
|
{:style (reanimated/apply-animations-to-style
|
||||||
{:height shared-height}
|
{:height shared-height}
|
||||||
|
@ -325,7 +331,7 @@
|
||||||
{:icon true
|
{:icon true
|
||||||
:size 32
|
:size 32
|
||||||
:accessibility-label :send-message-button
|
:accessibility-label :send-message-button
|
||||||
:on-press #(do (clean-and-minimize-composer-fn false)
|
:on-press #(do (clean-and-minimize-composer-fn (some? edit))
|
||||||
(scroll-to-bottom)
|
(scroll-to-bottom)
|
||||||
(rf/dispatch [:chat.ui/send-current-message]))}
|
(rf/dispatch [:chat.ui/send-current-message]))}
|
||||||
:i/arrow-up]]])
|
:i/arrow-up]]])
|
||||||
|
|
|
@ -145,7 +145,8 @@
|
||||||
message-id)
|
message-id)
|
||||||
reply (assoc reply
|
reply (assoc reply
|
||||||
:deleted? deleted?
|
:deleted? deleted?
|
||||||
:deleted-for-me? deleted-for-me?)]
|
: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 reply false pin?]]))
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,12 @@
|
||||||
(defn banner
|
(defn banner
|
||||||
[chat-id]
|
[chat-id]
|
||||||
(let [pinned-messages (rf/sub [:chats/pinned chat-id])
|
(let [pinned-messages (rf/sub [:chats/pinned chat-id])
|
||||||
latest-pin-text (get-in (last (vals pinned-messages)) [:content :text])
|
latest-pin-id (-> pinned-messages
|
||||||
|
vals
|
||||||
|
last
|
||||||
|
(get :message-id))
|
||||||
|
latest-pin-text (get-in (rf/sub [:chats/chat-messages chat-id])
|
||||||
|
[latest-pin-id :content :text])
|
||||||
pins-count (count (seq pinned-messages))]
|
pins-count (count (seq pinned-messages))]
|
||||||
(when (> pins-count 0)
|
(when (> pins-count 0)
|
||||||
;; TODO (flexsurfer) this should be banner component in quo2
|
;; TODO (flexsurfer) this should be banner component in quo2
|
||||||
|
|
|
@ -10,12 +10,13 @@
|
||||||
(def list-key-fn #(or (:message-id %) (:value %)))
|
(def list-key-fn #(or (:message-id %) (:value %)))
|
||||||
|
|
||||||
(defn message-render-fn
|
(defn message-render-fn
|
||||||
[{:keys [whisper-timestamp] :as message}
|
[{:keys [whisper-timestamp message-id chat-id] :as message}
|
||||||
_
|
_
|
||||||
{:keys [group-chat public? community? current-public-key show-input? edit-enabled]}]
|
{:keys [group-chat public? community? current-public-key show-input? edit-enabled]}]
|
||||||
;; TODO (flexsurfer) probably we don't want reactions here
|
;; TODO (flexsurfer) probably we don't want reactions here
|
||||||
|
(let [message-content-sub (get-in (rf/sub [:chats/chat-messages chat-id]) [message-id :content])]
|
||||||
[message/message-with-reactions
|
[message/message-with-reactions
|
||||||
message
|
(assoc message :content message-content-sub)
|
||||||
{:group-chat group-chat
|
{:group-chat group-chat
|
||||||
:public? public?
|
:public? public?
|
||||||
:community? community?
|
:community? community?
|
||||||
|
@ -25,7 +26,7 @@
|
||||||
:in-pinned-view? true
|
:in-pinned-view? true
|
||||||
:pinned true
|
:pinned true
|
||||||
:timestamp-str (time/timestamp->time whisper-timestamp)
|
:timestamp-str (time/timestamp->time whisper-timestamp)
|
||||||
:edit-enabled edit-enabled}])
|
:edit-enabled edit-enabled}]))
|
||||||
|
|
||||||
(defn pinned-messages-list
|
(defn pinned-messages-list
|
||||||
[chat-id]
|
[chat-id]
|
||||||
|
|
Loading…
Reference in New Issue