chore: Fix subs leak and fix schema error (#19321)

This commit is contained in:
Ibrahem Khalil 2024-03-19 14:14:15 +02:00 committed by GitHub
parent 01a881523f
commit 27407b9cbb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 14 additions and 15 deletions

View File

@ -22,7 +22,6 @@
(reg-root-key-sub :peers-count :peers-count) (reg-root-key-sub :peers-count :peers-count)
(reg-root-key-sub :peers-summary :peers-summary) (reg-root-key-sub :peers-summary :peers-summary)
(reg-root-key-sub :web3-node-version :web3-node-version) (reg-root-key-sub :web3-node-version :web3-node-version)
(reg-root-key-sub :alert-banners :alert-banners)
;;keycard ;;keycard
(reg-root-key-sub :keycard :keycard) (reg-root-key-sub :keycard :keycard)

View File

@ -200,7 +200,8 @@
[] []
(let [chat-input (rf/sub [:chats/current-chat-input])] (let [chat-input (rf/sub [:chats/current-chat-input])]
{:images (seq (rf/sub [:chats/sending-image])) {:images (seq (rf/sub [:chats/sending-image]))
:link-previews? (rf/sub [:chats/link-previews?]) :link-previews? (or (rf/sub [:chats/link-previews?])
(rf/sub [:chats/status-link-previews?]))
:audio (rf/sub [:chats/sending-audio]) :audio (rf/sub [:chats/sending-audio])
:reply (rf/sub [:chats/reply-message]) :reply (rf/sub [:chats/reply-message])
:edit (rf/sub [:chats/edit-message]) :edit (rf/sub [:chats/edit-message])

View File

@ -235,10 +235,10 @@
[:cofx :schema.re-frame/cofx] [:cofx :schema.re-frame/cofx]
[:args [:args
[:schema [:schema
[:catn [:vector
[:map [:map {:closed true}
[:community-id [:? :string]] [:community-id {:optional true} :string]
[:update-last-opened-at? [:? :boolean]]]]]]] [:update-last-opened-at? {:optional true} [:maybe :boolean]]]]]]]
[:maybe [:maybe
[:map [:map
[:db map?] [:db map?]

View File

@ -24,7 +24,7 @@
(testing "do nothing" (testing "do nothing"
(is (match? (is (match?
nil nil
(events/fetch-community {} [])))))) (events/fetch-community {} [{}]))))))
(deftest community-failed-to-fetch (deftest community-failed-to-fetch
(testing "given a community id" (testing "given a community id"

View File

@ -32,11 +32,6 @@
:params [(or preferred-name display-name name) ""] :params [(or preferred-name display-name name) ""]
:on-success #(log/debug "sent contact update")}]]))]})) :on-success #(log/debug "sent contact update")}]]))]}))
(rf/reg-event-fx :profile.settings/change-preview-privacy
(fn [{:keys [db]}]
(let [private? (get-in db [:profile/profile :preview-privacy?])]
{:fx [[:profile.settings/blank-preview-flag-changed private?]]})))
(rf/reg-event-fx :profile.settings/change-webview-debug (rf/reg-event-fx :profile.settings/change-webview-debug
(fn [_ [value]] (fn [_ [value]]
(let [value' (boolean value)] (let [value' (boolean value)]

View File

@ -433,10 +433,14 @@
(re-frame/reg-sub (re-frame/reg-sub
:chats/link-previews? :chats/link-previews?
:<- [:chats/link-previews-unfurled] :<- [:chats/link-previews-unfurled]
(fn [previews]
(boolean (seq previews))))
(re-frame/reg-sub
:chats/status-link-previews?
:<- [:chats/status-link-previews-unfurled] :<- [:chats/status-link-previews-unfurled]
(fn [previews status-link-previews] (fn [status-link-previews]
(boolean (or (seq status-link-previews) (boolean (seq status-link-previews))))
(seq previews)))))
(re-frame/reg-sub (re-frame/reg-sub
:chat/check-channel-muted? :chat/check-channel-muted?