Mute community
* mute and unmute communitydfdaa722...e6187aec
* mute and unmute community and all community chatsdfdaa722...3abc86e4
* updated statu-godfdaa722...919123e1
* refactored mute chat drawerd3e650d5...3af0b17c
* refactored mute chat drawerdfdaa722...3af0b17c
* fixing mute channels * fixed mute community channels * update community chats mute statusdfdaa722...dc50ac21
* added mute and unmute community toastdfdaa722...c06f7a6c
* unmute community when atleast one community channel is unmuteddfdaa722...e691c475
* updated status-gob2e56f5d...c52718cd
* updated status-go version v0.162.5
This commit is contained in:
parent
32f18c3d3c
commit
2317e856bf
|
@ -3,6 +3,7 @@
|
||||||
[quo2.components.community.style :as style]
|
[quo2.components.community.style :as style]
|
||||||
[quo2.components.counter.counter :as counter]
|
[quo2.components.counter.counter :as counter]
|
||||||
[quo2.components.icon :as icons]
|
[quo2.components.icon :as icons]
|
||||||
|
[quo2.theme :as theme]
|
||||||
[quo2.components.markdown.text :as text]
|
[quo2.components.markdown.text :as text]
|
||||||
[quo2.foundations.colors :as colors]
|
[quo2.foundations.colors :as colors]
|
||||||
[quo2.components.community.icon :as community-icon]
|
[quo2.components.community.icon :as community-icon]
|
||||||
|
@ -21,18 +22,65 @@
|
||||||
:resize-mode :center
|
:resize-mode :center
|
||||||
:size 20
|
:size 20
|
||||||
:color (colors/theme-colors
|
:color (colors/theme-colors
|
||||||
colors/neutral-40
|
colors/neutral-50
|
||||||
colors/neutral-50)}]
|
colors/neutral-40)}]
|
||||||
(pos? unread-mentions-count)
|
(pos? unread-mentions-count)
|
||||||
[counter/counter {:type :default} unread-mentions-count]
|
[counter/counter {:type :default} unread-mentions-count]
|
||||||
|
|
||||||
unread-messages?
|
unread-messages?
|
||||||
[unread-grey-dot :unviewed-messages-public]))
|
[unread-grey-dot :unviewed-messages-public]))
|
||||||
|
|
||||||
(defn communities-membership-list-item
|
(defn communities-list-view-item
|
||||||
[props
|
[props
|
||||||
{:keys [name
|
{:keys [name
|
||||||
muted?
|
locked?
|
||||||
|
status
|
||||||
|
muted
|
||||||
|
unread-messages?
|
||||||
|
unread-mentions-count
|
||||||
|
community-icon
|
||||||
|
tokens]}]
|
||||||
|
[rn/view
|
||||||
|
{:style (merge (style/community-card 16)
|
||||||
|
{:margin-bottom 12})}
|
||||||
|
[rn/touchable-highlight
|
||||||
|
(merge {:style {:height 56
|
||||||
|
:border-radius 16}}
|
||||||
|
props)
|
||||||
|
[rn/view {:style style/detail-container}
|
||||||
|
[rn/view (style/list-info-container)
|
||||||
|
[community-icon/community-icon
|
||||||
|
{:images community-icon} 32]
|
||||||
|
[rn/view
|
||||||
|
{:flex 1
|
||||||
|
:margin-horizontal 12}
|
||||||
|
[text/text
|
||||||
|
{:weight :semi-bold
|
||||||
|
:size :paragraph-1
|
||||||
|
:accessibility-label :community-name-text
|
||||||
|
:number-of-lines 1
|
||||||
|
:ellipsize-mode :tail
|
||||||
|
:style {:color (when muted
|
||||||
|
(colors/theme-colors
|
||||||
|
colors/neutral-40
|
||||||
|
colors/neutral-60))}}
|
||||||
|
name]
|
||||||
|
[community-view/community-stats-column
|
||||||
|
{:type :list-view}]]
|
||||||
|
(if (= status :gated)
|
||||||
|
[community-view/permission-tag-container
|
||||||
|
{:locked? locked?
|
||||||
|
:tokens tokens}]
|
||||||
|
[notification-view
|
||||||
|
{:muted? muted
|
||||||
|
:unread-mentions-count unread-mentions-count
|
||||||
|
:unread-messages? unread-messages?}])]]]])
|
||||||
|
|
||||||
|
(defn communities-membership-list-item
|
||||||
|
[props
|
||||||
|
bottom-sheet?
|
||||||
|
{:keys [name
|
||||||
|
muted
|
||||||
unviewed-messages-count
|
unviewed-messages-count
|
||||||
unviewed-mentions-count
|
unviewed-mentions-count
|
||||||
status
|
status
|
||||||
|
@ -59,17 +107,22 @@
|
||||||
:number-of-lines 1
|
:number-of-lines 1
|
||||||
:ellipsize-mode :tail
|
:ellipsize-mode :tail
|
||||||
:weight :semi-bold
|
:weight :semi-bold
|
||||||
:size :paragraph-1}
|
:size :paragraph-1
|
||||||
|
:style (when muted
|
||||||
|
{:color (if (theme/dark?)
|
||||||
|
colors/neutral-60
|
||||||
|
colors/neutral-40)})}
|
||||||
name]]
|
name]]
|
||||||
|
|
||||||
[rn/view
|
[rn/view
|
||||||
{:justify-content :center
|
{:justify-content :center
|
||||||
:margin-right 16}
|
:margin-right (when bottom-sheet?
|
||||||
|
16)}
|
||||||
(if (= status :gated)
|
(if (= status :gated)
|
||||||
[community-view/permission-tag-container
|
[community-view/permission-tag-container
|
||||||
{:locked? locked?
|
{:locked? locked?
|
||||||
:tokens tokens}]
|
:tokens tokens}]
|
||||||
[notification-view
|
[notification-view
|
||||||
{:muted? muted?
|
{:muted? muted
|
||||||
:unread-mentions-count unviewed-mentions-count
|
:unread-mentions-count unviewed-mentions-count
|
||||||
:unread-messages? (pos? unviewed-messages-count)}])]]])
|
:unread-messages? (pos? unviewed-messages-count)}])]]])
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
[clojure.string :as string]
|
[clojure.string :as string]
|
||||||
[clojure.walk :as walk]
|
[clojure.walk :as walk]
|
||||||
[quo.design-system.colors :as colors]
|
[quo.design-system.colors :as colors]
|
||||||
|
[quo2.foundations.colors :as quo2.colors]
|
||||||
[re-frame.core :as re-frame]
|
[re-frame.core :as re-frame]
|
||||||
[status-im.utils.types :as types]
|
[status-im.utils.types :as types]
|
||||||
[status-im.async-storage.core :as async-storage]
|
[status-im.async-storage.core :as async-storage]
|
||||||
|
@ -16,6 +17,7 @@
|
||||||
[taoensso.timbre :as log]
|
[taoensso.timbre :as log]
|
||||||
[utils.i18n :as i18n]
|
[utils.i18n :as i18n]
|
||||||
[utils.re-frame :as rf]
|
[utils.re-frame :as rf]
|
||||||
|
[status-im2.common.muting.helpers :refer [format-mute-till]]
|
||||||
[status-im2.contexts.chat.events :as chat.events]))
|
[status-im2.contexts.chat.events :as chat.events]))
|
||||||
|
|
||||||
(def crop-size 1000)
|
(def crop-size 1000)
|
||||||
|
@ -72,7 +74,8 @@
|
||||||
:isMember :is-member?
|
:isMember :is-member?
|
||||||
:adminSettings :admin-settings
|
:adminSettings :admin-settings
|
||||||
:tokenPermissions :token-permissions
|
:tokenPermissions :token-permissions
|
||||||
:communityTokensMetadata :tokens-metadata})
|
:communityTokensMetadata :tokens-metadata
|
||||||
|
:muteTill :muted-till})
|
||||||
(update :admin-settings
|
(update :admin-settings
|
||||||
set/rename-keys
|
set/rename-keys
|
||||||
{:pinMessageAllMembersEnabled :pin-message-all-members-enabled?})
|
{:pinMessageAllMembersEnabled :pin-message-all-members-enabled?})
|
||||||
|
@ -938,3 +941,58 @@
|
||||||
{:error %
|
{:error %
|
||||||
:event
|
:event
|
||||||
:communities/check-and-delete-pending-request-to-join-community})}]})
|
:communities/check-and-delete-pending-request-to-join-community})}]})
|
||||||
|
|
||||||
|
(rf/defn mute-community-chats
|
||||||
|
{:events [:community/mute-community-chats]}
|
||||||
|
[{:keys [db]} chat-id muted? muted-till]
|
||||||
|
(log/debug "muted community chat successfully" chat-id muted?)
|
||||||
|
{:db (update-in db [:chats chat-id] merge {:muted muted? :muted-till muted-till})})
|
||||||
|
|
||||||
|
(rf/defn mute-and-unmute-community-chats
|
||||||
|
{:events [:community/update-community-chats-mute-status]}
|
||||||
|
[{:keys [db]} community-id muted? mute-till]
|
||||||
|
(let [channels (get-in db [:communities community-id :chats])
|
||||||
|
chats (mapv vector (keys channels) (vals channels))]
|
||||||
|
(doseq [x chats]
|
||||||
|
(doseq [{:keys [id]} x]
|
||||||
|
(let [chat-id (str community-id id)]
|
||||||
|
(rf/dispatch [:community/mute-community-chats chat-id muted? mute-till]))))))
|
||||||
|
|
||||||
|
(rf/defn mute-chat-failed
|
||||||
|
{:events [:community/mute-community-failed]}
|
||||||
|
[{:keys [db]} community-id muted? error]
|
||||||
|
(log/error "mute community failed" community-id error)
|
||||||
|
{:db (update-in db [:communities community-id :muted] (not muted?))}
|
||||||
|
(rf/dispatch [:community/update-community-chats-mute-status community-id muted? error]))
|
||||||
|
|
||||||
|
(rf/defn mute-community-successfully
|
||||||
|
{:events [:community/mute-community-successful]}
|
||||||
|
[{:keys [db]} community-id muted? muted-till]
|
||||||
|
(log/debug "muted community successfully" community-id muted-till)
|
||||||
|
(rf/dispatch [:community/update-community-chats-mute-status community-id muted? muted-till])
|
||||||
|
(let [time-string (fn [mute-title mute-duration]
|
||||||
|
(i18n/label mute-title {:duration mute-duration}))]
|
||||||
|
{:db (assoc-in db [:communities community-id :muted-till] muted-till)
|
||||||
|
:dispatch [:toasts/upsert
|
||||||
|
{:icon :correct
|
||||||
|
:icon-color (quo2.colors/theme-colors
|
||||||
|
quo2.colors/success-60
|
||||||
|
quo2.colors/success-50)
|
||||||
|
:text (if muted?
|
||||||
|
(when (some? muted-till)
|
||||||
|
(time-string :t/muted-until (format-mute-till muted-till)))
|
||||||
|
(i18n/label :t/community-unmuted))}]}))
|
||||||
|
|
||||||
|
|
||||||
|
(rf/defn set-community-muted
|
||||||
|
{:events [:community/set-muted]}
|
||||||
|
[{:keys [db]} community-id muted? muted-type]
|
||||||
|
(let [params (if muted? [{:communityId community-id :mutedType muted-type}] [community-id])
|
||||||
|
method (if muted? "wakuext_muteCommunityChats" "wakuext_unMuteCommunityChats")]
|
||||||
|
{:db (assoc-in db [:communities community-id :muted] muted?)
|
||||||
|
:json-rpc/call [{:method method
|
||||||
|
:params params
|
||||||
|
:on-error #(rf/dispatch [:community/mute-community-failed community-id
|
||||||
|
muted? %])
|
||||||
|
:on-success #(rf/dispatch [:community/mute-community-successful
|
||||||
|
community-id muted? %])}]}))
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
[status-im2.contexts.contacts.drawers.nickname-drawer.view :as nickname-drawer]
|
[status-im2.contexts.contacts.drawers.nickname-drawer.view :as nickname-drawer]
|
||||||
[utils.i18n :as i18n]
|
[utils.i18n :as i18n]
|
||||||
[utils.re-frame :as rf]
|
[utils.re-frame :as rf]
|
||||||
[status-im2.common.mute-chat-drawer.view :as mute-chat-drawer]
|
[status-im2.common.mute-drawer.view :as mute-drawer]
|
||||||
[status-im2.common.muting.helpers :refer [format-mute-till]]))
|
[status-im2.common.muting.helpers :refer [format-mute-till]]))
|
||||||
|
|
||||||
(defn- entry
|
(defn- entry
|
||||||
|
@ -53,11 +53,15 @@
|
||||||
:accessibility-label :edit-nickname}])}]))
|
:accessibility-label :edit-nickname}])}]))
|
||||||
|
|
||||||
(defn mute-chat-action
|
(defn mute-chat-action
|
||||||
[chat-id chat-type]
|
[chat-id chat-type muted?]
|
||||||
(hide-sheet-and-dispatch [:show-bottom-sheet
|
(hide-sheet-and-dispatch [:show-bottom-sheet
|
||||||
{:content (fn []
|
{:content (fn []
|
||||||
[mute-chat-drawer/mute-chat-drawer chat-id
|
[mute-drawer/mute-drawer
|
||||||
:mute-chat-for-duration chat-type])}]))
|
{:id chat-id
|
||||||
|
:community? false
|
||||||
|
:muted? (not muted?)
|
||||||
|
:chat-type chat-type
|
||||||
|
:accessibility-label :mute-community-title}])}]))
|
||||||
|
|
||||||
(defn unmute-chat-action
|
(defn unmute-chat-action
|
||||||
[chat-id]
|
[chat-id]
|
||||||
|
@ -136,7 +140,7 @@
|
||||||
(format-mute-till muted-till)))
|
(format-mute-till muted-till)))
|
||||||
:on-press (if muted?
|
:on-press (if muted?
|
||||||
#(unmute-chat-action chat-id)
|
#(unmute-chat-action chat-id)
|
||||||
#(mute-chat-action chat-id chat-type))
|
#(mute-chat-action chat-id chat-type muted?))
|
||||||
:danger? false
|
:danger? false
|
||||||
:accessibility-label :mute-chat
|
:accessibility-label :mute-chat
|
||||||
:chevron? (not muted?)})))
|
:chevron? (not muted?)})))
|
||||||
|
|
|
@ -1,76 +0,0 @@
|
||||||
(ns status-im2.common.mute-chat-drawer.view
|
|
||||||
(:require [utils.i18n :as i18n]
|
|
||||||
[quo2.core :as quo]
|
|
||||||
[react-native.core :as rn]
|
|
||||||
[status-im2.constants :as constants]
|
|
||||||
[utils.re-frame :as rf]
|
|
||||||
[status-im2.common.mute-chat-drawer.style :as style]))
|
|
||||||
|
|
||||||
(defn not-community-chat?
|
|
||||||
[chat-type]
|
|
||||||
(contains? #{constants/public-chat-type
|
|
||||||
constants/private-group-chat-type
|
|
||||||
constants/one-to-one-chat-type}
|
|
||||||
chat-type))
|
|
||||||
|
|
||||||
(defn hide-sheet-and-dispatch
|
|
||||||
[event]
|
|
||||||
(rf/dispatch [:hide-bottom-sheet])
|
|
||||||
(rf/dispatch event))
|
|
||||||
|
|
||||||
(defn mute-chat-drawer
|
|
||||||
[chat-id accessibility-label chat-type]
|
|
||||||
[rn/view {:accessibility-label accessibility-label}
|
|
||||||
[quo/text
|
|
||||||
{:weight :medium
|
|
||||||
:size :paragraph-2
|
|
||||||
:style (style/header-text)}
|
|
||||||
(i18n/label
|
|
||||||
(if (not-community-chat? chat-type)
|
|
||||||
:t/mute-chat-capitialized
|
|
||||||
:t/mute-channel))]
|
|
||||||
[quo/menu-item
|
|
||||||
{:type :transparent
|
|
||||||
:title (i18n/label :t/mute-for-15-mins)
|
|
||||||
:icon-bg-color :transparent
|
|
||||||
:container-padding-vertical 12
|
|
||||||
:title-column-style {:margin-left 2}
|
|
||||||
:on-press (fn []
|
|
||||||
(hide-sheet-and-dispatch [:chat.ui/mute chat-id true
|
|
||||||
constants/mute-for-15-mins-type]))}]
|
|
||||||
[quo/menu-item
|
|
||||||
{:type :transparent
|
|
||||||
:title (i18n/label :t/mute-for-1-hour)
|
|
||||||
:icon-bg-color :transparent
|
|
||||||
:container-padding-vertical 12
|
|
||||||
:title-column-style {:margin-left 2}
|
|
||||||
:on-press (fn []
|
|
||||||
(hide-sheet-and-dispatch [:chat.ui/mute chat-id true
|
|
||||||
constants/mute-for-1-hour-type]))}]
|
|
||||||
[quo/menu-item
|
|
||||||
{:type :transparent
|
|
||||||
:title (i18n/label :t/mute-for-8-hours)
|
|
||||||
:icon-bg-color :transparent
|
|
||||||
:container-padding-vertical 12
|
|
||||||
:title-column-style {:margin-left 2}
|
|
||||||
:on-press (fn []
|
|
||||||
(hide-sheet-and-dispatch [:chat.ui/mute chat-id true
|
|
||||||
constants/mute-for-8-hours-type]))}]
|
|
||||||
[quo/menu-item
|
|
||||||
{:type :transparent
|
|
||||||
:title (i18n/label :t/mute-for-1-week)
|
|
||||||
:icon-bg-color :transparent
|
|
||||||
:container-padding-vertical 12
|
|
||||||
:title-column-style {:margin-left 2}
|
|
||||||
:on-press (fn []
|
|
||||||
(hide-sheet-and-dispatch [:chat.ui/mute chat-id true
|
|
||||||
constants/mute-for-1-week]))}]
|
|
||||||
[quo/menu-item
|
|
||||||
{:type :transparent
|
|
||||||
:title (i18n/label :t/mute-till-unmute)
|
|
||||||
:icon-bg-color :transparent
|
|
||||||
:container-padding-vertical 12
|
|
||||||
:title-column-style {:margin-left 2}
|
|
||||||
:on-press (fn []
|
|
||||||
(hide-sheet-and-dispatch [:chat.ui/mute chat-id true
|
|
||||||
constants/mute-till-unmuted]))}]])
|
|
|
@ -1,4 +1,4 @@
|
||||||
(ns status-im2.common.mute-chat-drawer.style
|
(ns status-im2.common.mute-drawer.style
|
||||||
(:require [quo2.foundations.colors :as colors]))
|
(:require [quo2.foundations.colors :as colors]))
|
||||||
|
|
||||||
(defn header-text
|
(defn header-text
|
|
@ -0,0 +1,100 @@
|
||||||
|
(ns status-im2.common.mute-drawer.view
|
||||||
|
(:require [utils.i18n :as i18n]
|
||||||
|
[quo2.core :as quo]
|
||||||
|
[react-native.core :as rn]
|
||||||
|
[status-im2.constants :as constants]
|
||||||
|
[utils.re-frame :as rf]
|
||||||
|
[status-im2.common.mute-drawer.style :as style]))
|
||||||
|
|
||||||
|
(defn not-community-chat?
|
||||||
|
[chat-type]
|
||||||
|
(contains? #{constants/public-chat-type
|
||||||
|
constants/private-group-chat-type
|
||||||
|
constants/one-to-one-chat-type}
|
||||||
|
chat-type))
|
||||||
|
|
||||||
|
(defn hide-sheet-and-dispatch
|
||||||
|
[{:keys [id community? muted? muted-type]}]
|
||||||
|
(rf/dispatch [:hide-bottom-sheet])
|
||||||
|
(if community?
|
||||||
|
(rf/dispatch [:community/set-muted id muted? muted-type])
|
||||||
|
(rf/dispatch [:chat.ui/mute id muted? muted-type])))
|
||||||
|
|
||||||
|
(defn mute-drawer
|
||||||
|
[{:keys [id accessibility-label muted? chat-type community?]}]
|
||||||
|
[rn/view {:accessibility-label accessibility-label}
|
||||||
|
[quo/text
|
||||||
|
{:weight :medium
|
||||||
|
:size :paragraph-2
|
||||||
|
:style (style/header-text)}
|
||||||
|
(i18n/label
|
||||||
|
(if community?
|
||||||
|
:t/mute-community
|
||||||
|
(if (not-community-chat? chat-type)
|
||||||
|
:t/mute-chat-capitialized
|
||||||
|
:t/mute-channel)))]
|
||||||
|
[quo/menu-item
|
||||||
|
{:type :transparent
|
||||||
|
:title (i18n/label :t/mute-for-15-mins)
|
||||||
|
:icon-bg-color :transparent
|
||||||
|
:container-padding-vertical 12
|
||||||
|
:title-column-style {:margin-left 2}
|
||||||
|
:on-press (fn []
|
||||||
|
(hide-sheet-and-dispatch
|
||||||
|
{:id id
|
||||||
|
:chat-type chat-type
|
||||||
|
:muted? muted?
|
||||||
|
:community? community?
|
||||||
|
:muted-type constants/mute-for-15-mins-type}))}]
|
||||||
|
[quo/menu-item
|
||||||
|
{:type :transparent
|
||||||
|
:title (i18n/label :t/mute-for-1-hour)
|
||||||
|
:icon-bg-color :transparent
|
||||||
|
:container-padding-vertical 12
|
||||||
|
:title-column-style {:margin-left 2}
|
||||||
|
:on-press (fn []
|
||||||
|
(hide-sheet-and-dispatch
|
||||||
|
{:id id
|
||||||
|
:chat-type chat-type
|
||||||
|
:muted? muted?
|
||||||
|
:community? community?
|
||||||
|
:muted-type constants/mute-for-1-hour-type}))}]
|
||||||
|
[quo/menu-item
|
||||||
|
{:type :transparent
|
||||||
|
:title (i18n/label :t/mute-for-8-hours)
|
||||||
|
:icon-bg-color :transparent
|
||||||
|
:container-padding-vertical 12
|
||||||
|
:title-column-style {:margin-left 2}
|
||||||
|
:on-press (fn []
|
||||||
|
(hide-sheet-and-dispatch
|
||||||
|
{:id id
|
||||||
|
:chat-type chat-type
|
||||||
|
:muted? muted?
|
||||||
|
:community? community?
|
||||||
|
:muted-type constants/mute-for-8-hours-type}))}]
|
||||||
|
[quo/menu-item
|
||||||
|
{:type :transparent
|
||||||
|
:title (i18n/label :t/mute-for-1-week)
|
||||||
|
:icon-bg-color :transparent
|
||||||
|
:container-padding-vertical 12
|
||||||
|
:title-column-style {:margin-left 2}
|
||||||
|
:on-press (fn []
|
||||||
|
(hide-sheet-and-dispatch
|
||||||
|
{:id id
|
||||||
|
:chat-type chat-type
|
||||||
|
:muted? muted?
|
||||||
|
:community? community?
|
||||||
|
:muted-type constants/mute-for-1-week}))}]
|
||||||
|
[quo/menu-item
|
||||||
|
{:type :transparent
|
||||||
|
:title (i18n/label :t/mute-till-unmute)
|
||||||
|
:icon-bg-color :transparent
|
||||||
|
:container-padding-vertical 12
|
||||||
|
:title-column-style {:margin-left 2}
|
||||||
|
:on-press (fn []
|
||||||
|
(hide-sheet-and-dispatch
|
||||||
|
{:id id
|
||||||
|
:chat-type chat-type
|
||||||
|
:muted? muted?
|
||||||
|
:community? community?
|
||||||
|
:muted-type constants/mute-till-unmuted}))}]])
|
|
@ -48,6 +48,7 @@
|
||||||
(def ^:const mute-for-8-hours-type 3)
|
(def ^:const mute-for-8-hours-type 3)
|
||||||
(def ^:const mute-for-1-week 4)
|
(def ^:const mute-for-1-week 4)
|
||||||
(def ^:const mute-till-unmuted 5)
|
(def ^:const mute-till-unmuted 5)
|
||||||
|
(def ^:const un-muted 0)
|
||||||
|
|
||||||
(def ^:const activity-center-mark-all-as-read-undo-time-limit-ms 4000)
|
(def ^:const activity-center-mark-all-as-read-undo-time-limit-ms 4000)
|
||||||
(def ^:const activity-center-max-unread-count 99)
|
(def ^:const activity-center-max-unread-count 99)
|
||||||
|
|
|
@ -293,6 +293,12 @@
|
||||||
(deactivate-chat chat-id)
|
(deactivate-chat chat-id)
|
||||||
(offload-messages 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
|
(rf/defn mute-chat-failed
|
||||||
{:events [:chat/mute-failed]}
|
{:events [:chat/mute-failed]}
|
||||||
[{:keys [db]} chat-id muted? error]
|
[{:keys [db]} chat-id muted? error]
|
||||||
|
@ -303,6 +309,8 @@
|
||||||
{:events [:chat/mute-successfully]}
|
{:events [:chat/mute-successfully]}
|
||||||
[{:keys [db]} chat-id muted-till mute-type muted? chat-type]
|
[{:keys [db]} chat-id muted-till mute-type muted? chat-type]
|
||||||
(log/debug "muted chat successfully" chat-id " for" muted-till)
|
(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]
|
(let [time-string (fn [duration-kw unmute-time]
|
||||||
(i18n/label duration-kw {:duration unmute-time}))
|
(i18n/label duration-kw {:duration unmute-time}))
|
||||||
not-community-chat? #(contains? #{constants/public-chat-type
|
not-community-chat? #(contains? #{constants/public-chat-type
|
||||||
|
@ -361,7 +369,7 @@
|
||||||
:params params
|
:params params
|
||||||
:on-error #(rf/dispatch [:chat/mute-failed chat-id muted? %])
|
:on-error #(rf/dispatch [:chat/mute-failed chat-id muted? %])
|
||||||
:on-success #(rf/dispatch [:chat/mute-successfully chat-id % mute-type
|
:on-success #(rf/dispatch [:chat/mute-successfully chat-id % mute-type
|
||||||
(not muted?) chat-type])}]}))
|
muted? chat-type])}]}))
|
||||||
|
|
||||||
(rf/defn show-clear-history-confirmation
|
(rf/defn show-clear-history-confirmation
|
||||||
{:events [:chat.ui/show-clear-history-confirmation]}
|
{:events [:chat.ui/show-clear-history-confirmation]}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
[utils.i18n :as i18n]
|
[utils.i18n :as i18n]
|
||||||
[utils.re-frame :as rf]
|
[utils.re-frame :as rf]
|
||||||
[status-im2.common.muting.helpers :refer [format-mute-till]]
|
[status-im2.common.muting.helpers :refer [format-mute-till]]
|
||||||
[status-im2.common.mute-chat-drawer.view :as mute-chat-drawer]))
|
[status-im2.common.mute-drawer.view :as mute-drawer]))
|
||||||
|
|
||||||
(defn hide-sheet-and-dispatch
|
(defn hide-sheet-and-dispatch
|
||||||
[event]
|
[event]
|
||||||
|
@ -12,11 +12,15 @@
|
||||||
(rf/dispatch event))
|
(rf/dispatch event))
|
||||||
|
|
||||||
(defn- mute-channel-action
|
(defn- mute-channel-action
|
||||||
[chat-id chat-type]
|
[chat-id chat-type muted?]
|
||||||
(hide-sheet-and-dispatch [:show-bottom-sheet
|
(hide-sheet-and-dispatch [:show-bottom-sheet
|
||||||
{:content (fn []
|
{:content (fn []
|
||||||
[mute-chat-drawer/mute-chat-drawer chat-id
|
[mute-drawer/mute-drawer
|
||||||
:mute-chat-for-duration chat-type])}]))
|
{:id chat-id
|
||||||
|
:community? false
|
||||||
|
:muted? (not muted?)
|
||||||
|
:chat-type chat-type
|
||||||
|
:accessibility-label :mute-community-title}])}]))
|
||||||
|
|
||||||
(defn- unmute-channel-action
|
(defn- unmute-channel-action
|
||||||
[chat-id]
|
[chat-id]
|
||||||
|
@ -46,16 +50,16 @@
|
||||||
|
|
||||||
(defn- action-toggle-muted
|
(defn- action-toggle-muted
|
||||||
[id muted? muted-till chat-type]
|
[id muted? muted-till chat-type]
|
||||||
(let [muted (and muted? (some? muted-till))]
|
(let [muted (and muted? (some? muted-till))
|
||||||
|
time-string (fn [mute-title mute-duration]
|
||||||
|
(i18n/label mute-title {:duration mute-duration}))]
|
||||||
(cond-> {:icon :i/muted
|
(cond-> {:icon :i/muted
|
||||||
:accessibility-label :chat-toggle-muted
|
:accessibility-label :chat-toggle-muted
|
||||||
:sub-label (when muted
|
:sub-label (when (and muted? (some? muted-till))
|
||||||
(str (i18n/label :t/muted-until)
|
(time-string :t/muted-until (format-mute-till muted-till)))
|
||||||
" "
|
|
||||||
(format-mute-till muted-till)))
|
|
||||||
:on-press (if muted?
|
:on-press (if muted?
|
||||||
#(unmute-channel-action id)
|
#(unmute-channel-action id)
|
||||||
#(mute-channel-action id chat-type))
|
#(mute-channel-action id chat-type muted?))
|
||||||
:label (i18n/label (if muted
|
:label (i18n/label (if muted
|
||||||
:t/unmute-channel
|
:t/unmute-channel
|
||||||
:t/mute-channel))}
|
:t/mute-channel))}
|
||||||
|
|
|
@ -4,6 +4,9 @@
|
||||||
[quo2.core :as quo]
|
[quo2.core :as quo]
|
||||||
[status-im2.contexts.communities.actions.see-rules.view :as see-rules]
|
[status-im2.contexts.communities.actions.see-rules.view :as see-rules]
|
||||||
[status-im2.contexts.communities.actions.leave.view :as leave-menu]
|
[status-im2.contexts.communities.actions.leave.view :as leave-menu]
|
||||||
|
[status-im2.common.mute-drawer.view :as mute-options]
|
||||||
|
[status-im2.constants :as constants]
|
||||||
|
[status-im2.common.muting.helpers :refer [format-mute-till]]
|
||||||
[status-im2.contexts.communities.actions.token-gating.view :as token-gating]))
|
[status-im2.contexts.communities.actions.token-gating.view :as token-gating]))
|
||||||
|
|
||||||
(defn hide-sheet-and-dispatch
|
(defn hide-sheet-and-dispatch
|
||||||
|
@ -45,12 +48,26 @@
|
||||||
:on-press #(hide-sheet-and-dispatch [:chat.ui/mark-all-read-in-community-pressed id])})
|
:on-press #(hide-sheet-and-dispatch [:chat.ui/mark-all-read-in-community-pressed id])})
|
||||||
|
|
||||||
(defn mute-community
|
(defn mute-community
|
||||||
[_ muted?]
|
[id muted? muted-till]
|
||||||
|
(let [time-string (fn [mute-title mute-duration]
|
||||||
|
(i18n/label mute-title {:duration mute-duration}))]
|
||||||
{:icon (if muted? :i/muted :i/activity-center)
|
{:icon (if muted? :i/muted :i/activity-center)
|
||||||
:accessibility-label (if muted? :unmute-community :mute-community)
|
:accessibility-label (if muted? :unmute-community :mute-community)
|
||||||
:label (i18n/label (if muted? :t/unmute-community :t/mute-community))
|
:label (i18n/label (if muted? :t/unmute-community :t/mute-community))
|
||||||
:sub-label (when muted? (str "muted for 15 minutes"))
|
:sub-label (when (and muted? (some? muted-till))
|
||||||
:right-icon :i/chevron-right})
|
(time-string :t/muted-until (format-mute-till muted-till)))
|
||||||
|
:right-icon :i/chevron-right
|
||||||
|
:on-press (if muted?
|
||||||
|
#(hide-sheet-and-dispatch [:community/set-muted id (not muted?)
|
||||||
|
constants/un-muted])
|
||||||
|
#(hide-sheet-and-dispatch
|
||||||
|
[:show-bottom-sheet
|
||||||
|
{:content (fn []
|
||||||
|
[mute-options/mute-drawer
|
||||||
|
{:id id
|
||||||
|
:community? true
|
||||||
|
:muted? (not muted?)
|
||||||
|
:accessibility-label :mute-community-title}])}]))}))
|
||||||
|
|
||||||
(defn community-notification-settings
|
(defn community-notification-settings
|
||||||
[id]
|
[id]
|
||||||
|
@ -119,12 +136,12 @@
|
||||||
(not-joined-options id token-gated?))
|
(not-joined-options id token-gated?))
|
||||||
|
|
||||||
(defn joined-options
|
(defn joined-options
|
||||||
[id token-gated? muted?]
|
[id token-gated? muted? muted-till]
|
||||||
[[(view-members id)
|
[[(view-members id)
|
||||||
(view-rules id)
|
(view-rules id)
|
||||||
(when token-gated? (view-token-gating id))
|
(when token-gated? (view-token-gating id))
|
||||||
(mark-as-read id)
|
(mark-as-read id)
|
||||||
(mute-community id muted?)
|
(mute-community id muted? muted-till)
|
||||||
(community-notification-settings id)
|
(community-notification-settings id)
|
||||||
(invite-contacts id)
|
(invite-contacts id)
|
||||||
(show-qr id)
|
(show-qr id)
|
||||||
|
@ -132,12 +149,12 @@
|
||||||
[(assoc (leave-community id) :add-divider? true)]])
|
[(assoc (leave-community id) :add-divider? true)]])
|
||||||
|
|
||||||
(defn owner-options
|
(defn owner-options
|
||||||
[id token-gated? muted?]
|
[id token-gated? muted? muted-till]
|
||||||
[[(view-members id)
|
[[(view-members id)
|
||||||
(view-rules id)
|
(view-rules id)
|
||||||
(when token-gated? (view-token-gating id))
|
(when token-gated? (view-token-gating id))
|
||||||
(mark-as-read id)
|
(mark-as-read id)
|
||||||
(mute-community id muted?)
|
(mute-community id muted? muted-till)
|
||||||
(community-notification-settings id)
|
(community-notification-settings id)
|
||||||
(invite-contacts id)
|
(invite-contacts id)
|
||||||
(show-qr id)
|
(show-qr id)
|
||||||
|
@ -146,11 +163,11 @@
|
||||||
(defn get-context-drawers
|
(defn get-context-drawers
|
||||||
[{:keys [id]}]
|
[{:keys [id]}]
|
||||||
(let [{:keys [token-permissions admin joined
|
(let [{:keys [token-permissions admin joined
|
||||||
muted banList]} (rf/sub [:communities/community id])
|
muted banList muted-till]} (rf/sub [:communities/community id])
|
||||||
request-id (rf/sub [:communities/my-pending-request-to-join id])]
|
request-id (rf/sub [:communities/my-pending-request-to-join id])]
|
||||||
(cond
|
(cond
|
||||||
admin (owner-options id token-permissions muted)
|
admin (owner-options id token-permissions muted muted-till)
|
||||||
joined (joined-options id token-permissions muted)
|
joined (joined-options id token-permissions muted muted-till)
|
||||||
request-id (join-request-sent-options id token-permissions request-id)
|
request-id (join-request-sent-options id token-permissions request-id)
|
||||||
banList (banned-options id token-permissions)
|
banList (banned-options id token-permissions)
|
||||||
:else (not-joined-options id token-permissions))))
|
:else (not-joined-options id token-permissions))))
|
||||||
|
|
|
@ -27,7 +27,8 @@
|
||||||
{:content (fn []
|
{:content (fn []
|
||||||
[options/community-options-bottom-sheet id])
|
[options/community-options-bottom-sheet id])
|
||||||
:selected-item (fn []
|
:selected-item (fn []
|
||||||
[quo/communities-membership-list-item {} item])}])}
|
[quo/communities-membership-list-item {} true item])}])}
|
||||||
|
false
|
||||||
item]))
|
item]))
|
||||||
|
|
||||||
(def tabs-data
|
(def tabs-data
|
||||||
|
|
|
@ -46,6 +46,7 @@
|
||||||
{:padding-vertical 60
|
{:padding-vertical 60
|
||||||
:justify-content :center}
|
:justify-content :center}
|
||||||
[community-list-view/communities-membership-list-item {}
|
[community-list-view/communities-membership-list-item {}
|
||||||
|
false
|
||||||
(cond-> (merge @state data/community)
|
(cond-> (merge @state data/community)
|
||||||
(= :muted (:notifications @state))
|
(= :muted (:notifications @state))
|
||||||
(assoc :muted? true)
|
(assoc :muted? true)
|
||||||
|
|
|
@ -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.162.3",
|
"version": "v0.162.5",
|
||||||
"commit-sha1": "b2e56f5d2d22d7299a049f70127b415fae4da75a",
|
"commit-sha1": "cf2d72bfa83f094719a93b7b7fd5a68e3a68ab47",
|
||||||
"src-sha256": "0pz8ins5gz3f19syhi5rxz4j7115lakvw90yci85ci1k7rrhjxjk"
|
"src-sha256": "0x79nm1n6gbgz2lzsky29laap7m0r0hggrb2fsn07bf0xw0364qn"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1041,7 +1041,6 @@
|
||||||
"remote-notifications": "Remote notifications",
|
"remote-notifications": "Remote notifications",
|
||||||
"remote-notifications-subtitle": "Enable google push notifications",
|
"remote-notifications-subtitle": "Enable google push notifications",
|
||||||
"show-notifications": "Show notifications",
|
"show-notifications": "Show notifications",
|
||||||
"notification-settings": "Notifications",
|
|
||||||
"notification-settings": "Notification settings",
|
"notification-settings": "Notification settings",
|
||||||
"notifications-servers": "Notification servers",
|
"notifications-servers": "Notification servers",
|
||||||
"notifications-preferences": "Notification preferences",
|
"notifications-preferences": "Notification preferences",
|
||||||
|
@ -2209,11 +2208,9 @@
|
||||||
"read-more": "Read more",
|
"read-more": "Read more",
|
||||||
"token-gated-communities-info": "Here will be something relevant about this topic. This will help the user get more context and therefore have a better understanding of it.",
|
"token-gated-communities-info": "Here will be something relevant about this topic. This will help the user get more context and therefore have a better understanding of it.",
|
||||||
"dont-yell-at-me": "Don’t yell at me",
|
"dont-yell-at-me": "Don’t yell at me",
|
||||||
"view-channel-members-and-details": "View channel members and details",
|
|
||||||
"unmute-channel": "Unmute channel",
|
"unmute-channel": "Unmute channel",
|
||||||
"share-channel": "Share channel",
|
|
||||||
"all-messages": "All messages",
|
"all-messages": "All messages",
|
||||||
"muted-until": "Muted until",
|
"muted-until": "Muted until {{duration}}",
|
||||||
"until-you-turn-it-back-on": "you turn it back on",
|
"until-you-turn-it-back-on": "you turn it back on",
|
||||||
"mon": "Mon",
|
"mon": "Mon",
|
||||||
"tue": "Tue",
|
"tue": "Tue",
|
||||||
|
@ -2247,5 +2244,6 @@
|
||||||
"until": "until",
|
"until": "until",
|
||||||
"chat-unmuted-successfully": "Chat unmuted successfully! ",
|
"chat-unmuted-successfully": "Chat unmuted successfully! ",
|
||||||
"channel-unmuted-successfully": "Channel unmuted successfully! ",
|
"channel-unmuted-successfully": "Channel unmuted successfully! ",
|
||||||
"photo-saved": "Photo saved to your device"
|
"photo-saved": "Photo saved to your device",
|
||||||
|
"community-unmuted": "Community unmuted"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue