Disable starting a new chat for non mutual contact (#14726)

This commit is contained in:
Ibrahem Khalil 2023-01-14 12:57:45 +02:00 committed by GitHub
parent 4960f5a59c
commit aa8f5b3d48
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -23,9 +23,10 @@
(:require-macros [status-im.utils.views :as views])) (:require-macros [status-im.utils.views :as views]))
(defn actions (defn actions
[{:keys [public-key added? blocked? ens-name] :as contact} muted?] [{:keys [public-key added? blocked? ens-name mutual?] :as contact} muted?]
(concat [{:label (i18n/label :t/chat) (concat [{:label (i18n/label :t/chat)
:icon :main-icons/message :icon :main-icons/message
:disabled (not mutual?)
:action #(re-frame/dispatch [:contact.ui/send-message-pressed :action #(re-frame/dispatch [:contact.ui/send-message-pressed
{:public-key public-key {:public-key public-key
:ens-name ens-name}]) :ens-name ens-name}])
@ -177,6 +178,7 @@
[{:keys [icon label action selected disabled negative]}] [{:keys [icon label action selected disabled negative]}]
[react/touchable-highlight [react/touchable-highlight
{:on-press action {:on-press action
:disabled disabled
:style {:flex 1} :style {:flex 1}
:accessibility-label (str label "-item-button")} :accessibility-label (str label "-item-button")}
[react/view {:flex 1 :align-items :center} [react/view {:flex 1 :align-items :center}