[16728] Allow message editing to save link previews (#17117)
This commit is contained in:
parent
e1616ae514
commit
a218499f2a
|
@ -12,7 +12,8 @@
|
|||
[taoensso.timbre :as log]
|
||||
[utils.i18n :as i18n]
|
||||
[utils.re-frame :as rf]
|
||||
[utils.string :as utils.string]))
|
||||
[utils.string :as utils.string]
|
||||
[status-im.data-store.messages :as data-store-messages]))
|
||||
|
||||
(defn text->emoji
|
||||
"Replaces emojis in a specified `text`"
|
||||
|
@ -239,16 +240,23 @@
|
|||
:text (i18n/label :t/update-to-see-sticker {"locale" "en"})})))
|
||||
|
||||
(rf/defn send-edited-message
|
||||
[{:keys [db] :as cofx} text {:keys [message-id quoted-message chat-id]}]
|
||||
[{:keys [db]
|
||||
:as cofx} text {:keys [message-id quoted-message chat-id]}]
|
||||
(rf/merge
|
||||
cofx
|
||||
{:json-rpc/call [{:method "wakuext_editMessage"
|
||||
:params [{:id message-id
|
||||
:text text
|
||||
:content-type (if (message-content/emoji-only-content?
|
||||
{:text text :response-to quoted-message})
|
||||
{:text text
|
||||
:response-to quoted-message})
|
||||
constants/content-type-emoji
|
||||
constants/content-type-text)}]
|
||||
constants/content-type-text)
|
||||
:linkPreviews (map #(-> %
|
||||
(select-keys [:url :title :description
|
||||
:thumbnail])
|
||||
data-store-messages/->link-preview-rpc)
|
||||
(get-in db [:chat/link-previews :unfurled]))}]
|
||||
:js-response true
|
||||
:on-error #(log/error "failed to edit message " %)
|
||||
:on-success (fn [result]
|
||||
|
|
|
@ -17,10 +17,11 @@
|
|||
|
||||
(defn- <-link-preview-rpc
|
||||
[preview]
|
||||
(update preview
|
||||
:thumbnail
|
||||
(fn [thumbnail]
|
||||
(set/rename-keys thumbnail {:dataUri :data-uri}))))
|
||||
(update preview :thumbnail set/rename-keys {:dataUri :data-uri}))
|
||||
|
||||
(defn ->link-preview-rpc
|
||||
[preview]
|
||||
(update preview :thumbnail set/rename-keys {:data-uri :dataUri}))
|
||||
|
||||
(defn <-rpc
|
||||
[message]
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"_comment": "Instead use: scripts/update-status-go.sh <rev>",
|
||||
"owner": "status-im",
|
||||
"repo": "status-go",
|
||||
"version": "v0.166.4",
|
||||
"commit-sha1": "bf748de216a2061bf14afb2a410599485ee1ee7c",
|
||||
"src-sha256": "0acpdc8sw6i6zpxyfzahrfbr270ldcf3jv8g4bp4kh59q2mf6bxz"
|
||||
"version": "v0.166.5",
|
||||
"commit-sha1": "22ec4ac5861cd3c907c980469a73f685b43dbda0",
|
||||
"src-sha256": "0z9j9hrgab3qrc84nj12b97mkjqpas83ln5a9k6367d23jiqwmj6"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue