fix old stickers (#13901)

(cherry picked from commit 5d9bcb3adbf576070a452c19e44c63c4555f1119)
This commit is contained in:
flexsurfer 2022-08-31 12:54:30 +02:00 committed by andrey
parent c56ebf74c1
commit dc449b511e
No known key found for this signature in database
GPG Key ID: C20F2FDE9A98BA61
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"})}))) :text (i18n/label :t/update-to-listen-audio {"locale" "en"})})))
(fx/defn send-sticker-message (fx/defn send-sticker-message
[cofx {:keys [hash packID]} current-chat-id] [cofx {:keys [hash packID pack]} current-chat-id]
(when-not (or (string/blank? hash) (string/blank? packID)) (when-not (or (string/blank? hash) (and (string/blank? packID) (string/blank? pack)))
(chat.message/send-message cofx {:chat-id current-chat-id (chat.message/send-message cofx {:chat-id current-chat-id
:content-type constants/content-type-sticker :content-type constants/content-type-sticker
:sticker {:hash hash :sticker {:hash hash
:pack (int packID)} :pack (int (if (string/blank? packID) pack packID))}
:text (i18n/label :t/update-to-see-sticker {"locale" "en"})}))) :text (i18n/label :t/update-to-see-sticker {"locale" "en"})})))
(fx/defn send-edited-message [{:keys [db] :as cofx} text {:keys [message-id]}] (fx/defn send-edited-message [{:keys [db] :as cofx} text {:keys [message-id]}]
@ -306,7 +306,7 @@
(fx/defn chat-send-sticker (fx/defn chat-send-sticker
{:events [: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 (fx/merge
cofx cofx
{:db (update db {:db (update db
@ -314,7 +314,7 @@
(fn [recent] (fn [recent]
(conj (remove #(= hash (:hash %)) recent) sticker))) (conj (remove #(= hash (:hash %)) recent) sticker)))
::json-rpc/call [{:method "stickers_addRecent" ::json-rpc/call [{:method "stickers_addRecent"
:params [(int packID) hash] :params [(int (if (string/blank? packID) pack packID)) hash]
:on-success #()}]} :on-success #()}]}
(send-sticker-message sticker current-chat-id))) (send-sticker-message sticker current-chat-id)))

View File

@ -46,7 +46,7 @@
"Add 'url' parameter to stickers that are synchronized from other devices. "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." It is not sent from aanother devices but we have it in our db."
[synced-stickers stickers-from-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) (:stickers)
(filter (fn [sticker-db] (= (:hash sticker-db) (:hash %)))) (filter (fn [sticker-db] (= (:hash sticker-db) (:hash %))))
(first) (first)