Skip to content

Commit

Permalink
[Fixes: #12191] Fix muting chat
Browse files Browse the repository at this point in the history
  • Loading branch information
Serhy committed Jun 7, 2021
1 parent d72feed commit d1a3a27
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
8 changes: 1 addition & 7 deletions src/status_im/chat/models.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -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?]
Expand All @@ -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]}
Expand Down
2 changes: 1 addition & 1 deletion src/status_im/data_store/chats.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -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 %)}]})
7 changes: 7 additions & 0 deletions src/status_im/subs.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -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] _]
Expand Down
3 changes: 1 addition & 2 deletions src/status_im/ui/screens/profile/contact/views.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -205,4 +205,3 @@
:render-data {:chat-id current-chat-id}
:render-fn status.views/render-message
:data messages}]])))

6 changes: 3 additions & 3 deletions status-go-version.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

0 comments on commit d1a3a27

Please sign in to comment.