File tree 2 files changed +14
-11
lines changed
2 files changed +14
-11
lines changed Original file line number Diff line number Diff line change 87
87
:identicon (.-identicon chat)
88
88
:muted (.-muted chat)
89
89
:joined (.-joined chat)
90
-
90
+ :muted-till ( .-mutetill chat)
91
91
:chat-id (.-id chat)
92
92
:community-id (.-communityId chat)
93
93
:synced-from (.-syncedFrom chat)
Original file line number Diff line number Diff line change 63
63
(defn map-chats
64
64
[{:keys [db] :as cofx}]
65
65
(fn [val]
66
- (assoc
67
- (merge
68
- (or (get (:chats db) (:chat-id val))
69
- (create-new-chat (:chat-id val) cofx))
70
- val)
71
- :invitation-admin
72
- (:invitation-admin val))))
66
+ (let [chat (or (get (:chats db) (:chat-id val))
67
+ (create-new-chat (:chat-id val) cofx))]
68
+ (assoc
69
+ (merge
70
+ (cond-> chat
71
+ (comp not :muted ) (dissoc chat :muted-till ))
72
+ val)
73
+ :invitation-admin
74
+ (:invitation-admin val)))))
73
75
74
76
(rf/defn leave-removed-chat
75
77
[{{:keys [view-id current-chat-id chats]} :db
291
293
292
294
(rf/defn mute-chat-toggled-successfully
293
295
{:events [:chat/mute-successfully ]}
294
- [_ chat-id]
295
- (log/debug " muted chat successfully" chat-id))
296
+ [{:keys [db]} chat-id muted-till]
297
+ (log/debug " muted chat successfully" chat-id " for" muted-till)
298
+ {:db (assoc-in db [:chats chat-id :muted-till ] muted-till)})
296
299
297
300
(rf/defn mute-chat
298
301
{:events [:chat.ui/mute ]}
303
306
:json-rpc/call [{:method method
304
307
:params params
305
308
:on-error #(rf/dispatch [:chat/mute-failed chat-id muted? %])
306
- :on-success #(rf/dispatch [:chat/mute-successfully chat-id])}]}))
309
+ :on-success #(rf/dispatch [:chat/mute-successfully chat-id % ])}]}))
307
310
308
311
(rf/defn show-clear-history-confirmation
309
312
{:events [:chat.ui/show-clear-history-confirmation ]}
You can’t perform that action at this time.
0 commit comments