From 3568b20522273e0c57d1f00d9a8ea31eadcda521 Mon Sep 17 00:00:00 2001 From: Andrea Maria Piana Date: Fri, 4 Jun 2021 13:33:30 +0200 Subject: [PATCH] [Fixes: #12191] Fix muting chat Signed-off-by: Andrea Maria Piana --- src/status_im/chat/models.cljs | 8 +------- src/status_im/data_store/chats.cljs | 2 +- src/status_im/subs.cljs | 7 +++++++ src/status_im/ui/screens/profile/contact/views.cljs | 3 +-- status-go-version.json | 6 +++--- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/status_im/chat/models.cljs b/src/status_im/chat/models.cljs index a2607326dd..f09ab81e0c 100644 --- a/src/status_im/chat/models.cljs +++ b/src/status_im/chat/models.cljs @@ -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]} diff --git a/src/status_im/data_store/chats.cljs b/src/status_im/data_store/chats.cljs index 2b772cb6be..51ecd7313b 100644 --- a/src/status_im/data_store/chats.cljs +++ b/src/status_im/data_store/chats.cljs @@ -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 %)}]}) diff --git a/src/status_im/subs.cljs b/src/status_im/subs.cljs index 5421996a6e..0b077baa27 100644 --- a/src/status_im/subs.cljs +++ b/src/status_im/subs.cljs @@ -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] _] diff --git a/src/status_im/ui/screens/profile/contact/views.cljs b/src/status_im/ui/screens/profile/contact/views.cljs index ad978340db..79606cf03e 100644 --- a/src/status_im/ui/screens/profile/contact/views.cljs +++ b/src/status_im/ui/screens/profile/contact/views.cljs @@ -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}]]))) - diff --git a/status-go-version.json b/status-go-version.json index f6b3cb9e99..b057d445d3 100644 --- a/status-go-version.json +++ b/status-go-version.json @@ -2,7 +2,7 @@ "_comment": "DO NOT EDIT THIS FILE BY HAND. USE 'scripts/update-status-go.sh ' 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" }