Skip to content

Commit

Permalink
unmute community when atleast one channel is unmuted
Browse files Browse the repository at this point in the history
  • Loading branch information
jo-mut committed Jul 5, 2023
1 parent 910c315 commit 48e8acb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
10 changes: 9 additions & 1 deletion src/status_im2/contexts/chat/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,12 @@
(deactivate-chat chat-id)
(offload-messages chat-id)))

(rf/defn unmute-chat-community
{:events [:chat/unmute-chat-community]}
[{:keys [db]} chat-id muted?]
(let [{:keys [community-id]} (get-in db [:chats chat-id])]
{:db (assoc-in db [:communities community-id :muted] muted?)}))

(rf/defn mute-chat-failed
{:events [:chat/mute-failed]}
[{:keys [db]} chat-id muted? error]
Expand All @@ -298,6 +304,8 @@
{:events [:chat/mute-successfully]}
[{:keys [db]} chat-id muted-till mute-type muted? chat-type]
(log/debug "muted chat successfully" chat-id " for" muted-till)
(when-not muted?
(rf/dispatch [:chat/unmute-chat-community chat-id muted?]))
(let [time-string (fn [duration-kw unmute-time]
(i18n/label duration-kw {:duration unmute-time}))
not-community-chat? #(contains? #{constants/public-chat-type
Expand Down Expand Up @@ -356,7 +364,7 @@
:params params
:on-error #(rf/dispatch [:chat/mute-failed chat-id muted? %])
:on-success #(rf/dispatch [:chat/mute-successfully chat-id % mute-type
(not muted?) chat-type])}]}))
muted? chat-type])}]}))

(rf/defn show-clear-history-confirmation
{:events [:chat.ui/show-clear-history-confirmation]}
Expand Down
4 changes: 2 additions & 2 deletions status-go-version.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"owner": "status-im",
"repo": "status-go",
"version": "ft/mute-community",
"commit-sha1": "c06f7a6c381488ce52cf212193970a079750c6fd",
"src-sha256": "1gbbq16phjkqxbijcflcvb2vx5z1s6i3bbsycpi1dbhxi3cq8y14"
"commit-sha1": "d92efd230394607a53080b0ee0618a2aeab9b12a",
"src-sha256": "0dz743lqbkwpm6bdsf756vw5jvlbkbfvc2nzav53npw3b7f4wvrw"
}

0 comments on commit 48e8acb

Please sign in to comment.