Don't unmute contact while adding (#13237)

This commit is contained in:
Parvesh Monu 2022-04-01 14:36:50 +05:30 committed by GitHub
parent 092b0ed427
commit fd9b010662
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 12 deletions

View File

@ -48,7 +48,7 @@
(defn active-chat? [cofx chat-id] (defn active-chat? [cofx chat-id]
(let [chat (get-chat cofx chat-id)] (let [chat (get-chat cofx chat-id)]
(not (nil? chat)))) (:active chat)))
(defn foreground-chat? (defn foreground-chat?
[{{:keys [current-chat-id view-id]} :db} chat-id] [{{:keys [current-chat-id view-id]} :db} chat-id]
@ -115,11 +115,11 @@
"Add chats to db and update" "Add chats to db and update"
[{:keys [db] :as cofx} chats] [{:keys [db] :as cofx} chats]
(let [{:keys [all-chats chats-home-list removed-chats]} (let [{:keys [all-chats chats-home-list removed-chats]}
(reduce (fn [acc {:keys [chat-id profile-public-key timeline? community-id active] :as chat}] (reduce (fn [acc {:keys [chat-id profile-public-key timeline? community-id active muted] :as chat}]
(if (not active) (if (not (or active muted))
(update acc :removed-chats conj chat-id) (update acc :removed-chats conj chat-id)
(cond-> acc (cond-> acc
(and (not profile-public-key) (not timeline?) (not community-id)) (and (not profile-public-key) (not timeline?) (not community-id) active)
(update :chats-home-list conj chat-id) (update :chats-home-list conj chat-id)
:always :always
(assoc-in [:all-chats chat-id] chat)))) (assoc-in [:all-chats chat-id] chat))))
@ -177,8 +177,9 @@
[{:keys [db now] :as cofx} chat-id] [{:keys [db now] :as cofx} chat-id]
(fx/merge (fx/merge
cofx cofx
{:db (-> db {:db (-> (if (get-in db [:chats chat-id :muted])
(update :chats dissoc chat-id) (assoc-in db [:chats chat-id :active] false)
(update db :chats dissoc chat-id))
(update :chats-home-list disj chat-id) (update :chats-home-list disj chat-id)
(assoc-in [:current-chat-id] nil)) (assoc-in [:current-chat-id] nil))
::json-rpc/call [{:method "wakuext_deactivateChat" ::json-rpc/call [{:method "wakuext_deactivateChat"

View File

@ -23,10 +23,10 @@
[{:keys [db]} ^js new-chats-js] [{:keys [db]} ^js new-chats-js]
(let [{:keys [all-chats chats-home-list]} (let [{:keys [all-chats chats-home-list]}
(reduce (fn [acc ^js chat-js] (reduce (fn [acc ^js chat-js]
(let [{:keys [chat-id profile-public-key timeline? community-id] :as chat} (let [{:keys [chat-id profile-public-key timeline? community-id active] :as chat}
(data-store.chats/<-rpc-js chat-js)] (data-store.chats/<-rpc-js chat-js)]
(cond-> acc (cond-> acc
(and (not profile-public-key) (not timeline?) (not community-id)) (and (not profile-public-key) (not timeline?) (not community-id) active)
(update :chats-home-list conj chat-id) (update :chats-home-list conj chat-id)
:always :always
(assoc-in [:all-chats chat-id] chat)))) (assoc-in [:all-chats chat-id] chat))))

View File

@ -97,7 +97,8 @@
:community-id (.-contentCommunityId chat)} :community-id (.-contentCommunityId chat)}
:last-clock-value (.-lastClockValue chat) :last-clock-value (.-lastClockValue chat)
:profile-public-key (.-profile chat) :profile-public-key (.-profile chat)
:highlight (.-highlight chat)} :highlight (.-highlight chat)
:active (.-active chat)}
rpc->type rpc->type
unmarshal-members)) unmarshal-members))

View File

@ -3,7 +3,7 @@
"_comment": "Instead use: scripts/update-status-go.sh <rev>", "_comment": "Instead use: scripts/update-status-go.sh <rev>",
"owner": "status-im", "owner": "status-im",
"repo": "status-go", "repo": "status-go",
"version": "v0.97.3", "version": "v0.97.4",
"commit-sha1": "331cf1e40188553b508e81193d42e0eee6d6a8c8", "commit-sha1": "724689086cdd3edef71a31c17e8888b1933c9ea5",
"src-sha256": "1yl7arvi6jlb591g6l2c4y41l5aqpvxcwl14iw73rp4qy4wvvcbz" "src-sha256": "091fc4ql9mp99ljw3l644bvkmwrfj2sq2mdhkwz6bn3z2maxgalk"
} }