fix old stickers (#13901)

This commit is contained in:
flexsurfer 2022-08-31 12:54:30 +02:00 committed by GitHub
parent ca8b721135
commit 5d9bcb3adb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View File

@ -244,12 +244,12 @@
:text (i18n/label :t/update-to-listen-audio {"locale" "en"})})))
(fx/defn send-sticker-message
[cofx {:keys [hash packID]} current-chat-id]
(when-not (or (string/blank? hash) (string/blank? packID))
[cofx {:keys [hash packID pack]} current-chat-id]
(when-not (or (string/blank? hash) (and (string/blank? packID) (string/blank? pack)))
(chat.message/send-message cofx {:chat-id current-chat-id
:content-type constants/content-type-sticker
:sticker {:hash hash
:pack (int packID)}
:pack (int (if (string/blank? packID) pack packID))}
:text (i18n/label :t/update-to-see-sticker {"locale" "en"})})))
(fx/defn send-edited-message [{:keys [db] :as cofx} text {:keys [message-id]}]
@ -306,7 +306,7 @@
(fx/defn chat-send-sticker
{:events [:chat/send-sticker]}
[{{:keys [current-chat-id] :as db} :db :as cofx} {:keys [hash packID] :as sticker}]
[{{:keys [current-chat-id] :as db} :db :as cofx} {:keys [hash packID pack] :as sticker}]
(fx/merge
cofx
{:db (update db
@ -314,7 +314,7 @@
(fn [recent]
(conj (remove #(= hash (:hash %)) recent) sticker)))
::json-rpc/call [{:method "stickers_addRecent"
:params [(int packID) hash]
:params [(int (if (string/blank? packID) pack packID)) hash]
:on-success #()}]}
(send-sticker-message sticker current-chat-id)))

View File

@ -44,7 +44,7 @@
"Add 'url' parameter to stickers that are synchronized from other devices.
It is not sent from aanother devices but we have it in our db."
[synced-stickers stickers-from-db]
(mapv #(assoc % :url (->> (get stickers-from-db (:packID %))
(mapv #(assoc % :url (->> (get stickers-from-db (or (:packID %) (:pack %)))
(:stickers)
(filter (fn [sticker-db] (= (:hash sticker-db) (:hash %))))
(first)