[Fixes: #12191] Fix muting chat

Signed-off-by: Andrea Maria Piana <andrea.maria.piana@gmail.com>
This commit is contained in:
Andrea Maria Piana 2021-06-04 13:33:30 +02:00
parent 1900e3038b
commit 3568b20522
No known key found for this signature in database
GPG Key ID: AA6CCA6DE0E06424
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

@ -790,6 +790,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.10",
"commit-sha1": "d5782fffafc0acde103842f63bccc787181ed8f9",
"src-sha256": "1s4wvvf70szadwp4mqlrb658n6rvkjnfswhkq5vkfqcya3ppw4w2"
"version": "v0.79.11",
"commit-sha1": "b395144704f29c9e1f4fd11714d1031a10160ad1",
"src-sha256": "13yzac5n7w7hzispphm6g5xhw6r62qxg2hvzcrcl9jpwy0frvzi2"
}