[Fixes: #12191] Fix muting chat

This commit is contained in:
Serhy 2021-06-07 13:18:25 +03:00
parent d72feed968
commit d1a3a27226
No known key found for this signature in database
GPG Key ID: 5D7C4B9E2B6F500B
5 changed files with 13 additions and 13 deletions

View File

@ -321,12 +321,6 @@
(log/error "mute chat failed" chat-id error)
{:db (assoc-in db [:chats chat-id :muted] (not muted?))})
(fx/defn mute-chat-successful
{:events [::mute-chat-successful]}
[{:keys [db]} chat-id response]
(let [chat (chats-store/<-rpc (first (:chats response)))]
{:db (assoc-in db [:chats chat-id] chat)}))
(fx/defn mute-chat
{:events [::mute-chat-toggled]}
[{:keys [db] :as cofx} chat-id muted?]
@ -335,7 +329,7 @@
::json-rpc/call [{:method (json-rpc/call-ext-method method)
:params [chat-id]
:on-error #(re-frame/dispatch [::mute-chat-failed chat-id muted? %])
:on-success #(re-frame/dispatch [::mute-chat-successful chat-id %])}]}))
:on-success #(log/debug "muted chat successfully")}]}))
(fx/defn show-profile
{:events [:chat.ui/show-profile]}

View File

@ -71,7 +71,7 @@
(dissoc :members)))
(fx/defn fetch-chats-rpc [cofx {:keys [on-success]}]
{::json-rpc/call [{:method (json-rpc/call-ext-method "activeChats")
{::json-rpc/call [{:method (json-rpc/call-ext-method "chats")
:params []
:on-success #(on-success (map <-rpc %))
:on-failure #(log/error "failed to fetch chats" 0 -1 %)}]})

View File

@ -780,6 +780,13 @@
(fn [{:keys [synced-from]}]
synced-from))
(re-frame/reg-sub
:chats/muted
(fn [[_ chat-id] _]
(re-frame/subscribe [:chat-by-id chat-id]))
(fn [{:keys [muted]}]
muted))
(re-frame/reg-sub
:chats/chat-type
(fn [[_ chat-id] _]

View File

@ -160,7 +160,7 @@
current-chat-id @(re-frame/subscribe [:chats/current-profile-chat])
messages @(re-frame/subscribe [:chats/profile-messages-stream current-chat-id])
no-messages? @(re-frame/subscribe [:chats/chat-no-messages? current-chat-id])
muted? (:muted @(re-frame/subscribe [:chats/chat public-key]))
muted? @(re-frame/subscribe [:chats/muted public-key])
[first-name second-name] (multiaccounts/contact-two-names contact true)
on-share #(re-frame/dispatch [:show-popover (merge
{:view :share-chat-key
@ -205,4 +205,3 @@
:render-data {:chat-id current-chat-id}
:render-fn status.views/render-message
:data messages}]])))

View File

@ -2,7 +2,7 @@
"_comment": "DO NOT EDIT THIS FILE BY HAND. USE 'scripts/update-status-go.sh <tag>' instead",
"owner": "status-im",
"repo": "status-go",
"version": "v0.79.7",
"commit-sha1": "60de443e89bd6a5d4f5b71e7038528d27f26090b",
"src-sha256": "0gjgkqyvpbwg8drwi2mpcan5vxqrnrzl1j0ccmm2m8vq7j3b1332"
"version": "v0.79.7+hotfix.1",
"commit-sha1": "f27cc7ef218383984b3a1cc7cdb69e649cbeeca2",
"src-sha256": "1xcby30rqiqcr05nrjv720ak3prgdcp3644sld8cbnxr1j0szd67"
}