Skip to content

Commit cf7984d

Browse files
committed
handle names properly
1 parent 06b5e98 commit cf7984d

File tree

2 files changed

+33
-30
lines changed

2 files changed

+33
-30
lines changed

src/status_im/common/home/actions/view.cljs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
[status-im.contexts.chat.contacts.drawers.nickname-drawer.view :as nickname-drawer]
1212
[status-im.contexts.communities.actions.chat.view :as communities-chat-actions]
1313
[utils.i18n :as i18n]
14-
[utils.re-frame :as rf]))
14+
[utils.re-frame :as rf]
15+
[status-im.contexts.profile.utils :as profile.utils]))
1516

1617
(defn- entry
1718
[{:keys [icon label on-press danger? sub-label chevron? add-divider? accessibility-label]}]
@@ -131,11 +132,11 @@
131132
public-key])}])}]))
132133

133134
(defn handle-trust-mark-action
134-
[{:keys [public-key primary-name trust-status] :as item}]
135+
[{:keys [public-key trust-status] :as item}]
135136
(hide-sheet-and-dispatch
136137
(if (= trust-status
137138
constants/contact-trust-status-untrustworthy)
138-
[:contact/remove-trust-status public-key primary-name]
139+
[:contact/remove-trust-status public-key (profile.utils/displayed-name item)]
139140
[:contact/mark-as-untrusted-sheet item])))
140141

141142
(defn mute-chat-entry
@@ -447,7 +448,6 @@
447448

448449
(defn contact-actions
449450
[{:keys [public-key added?] :as contact} {:keys [chat-id admin?] :as extra-data}]
450-
(tap> contact)
451451
(let [current-pub-key (rf/sub [:multiaccount/public-key])]
452452
[quo/action-drawer
453453
[[(view-profile-entry public-key)

src/status_im/contexts/contact/trust/events.cljs

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
[status-im.constants :as constants]
77
[taoensso.timbre :as log]
88
[utils.i18n :as i18n]
9-
[utils.re-frame :as rf]))
9+
[utils.re-frame :as rf]
10+
[status-im.contexts.profile.utils :as profile.utils]))
1011

1112
(rf/reg-event-fx :contact/mark-as-untrusted-success
1213
(fn [{:keys [db]} [contact-id name]]
@@ -45,28 +46,30 @@
4546
:on-error #(log/error "failed remove contact trust status" % contact-id)}]}))
4647

4748
(rf/reg-event-fx :contact/mark-as-untrusted-sheet
48-
(fn [_ [{:keys [public-key primary-name] :as item}]]
49-
{:dispatch
50-
[:show-bottom-sheet
51-
{:content (fn []
52-
[confirmation-drawer/confirmation-drawer
53-
{:title (i18n/label :t/mark-as-untrusted)
54-
:description (i18n/label :t/mark-as-untrusted-description
55-
{:username (:primary-name item)})
56-
:extra-action (fn []
57-
(rf/dispatch [:toasts/upsert
58-
{:id :remove-contact
59-
:type :positive
60-
:text (->> (i18n/label :t/removed-from-contacts)
61-
(string/lower-case)
62-
(str primary-name " "))}])
63-
(rf/dispatch [:contact.ui/remove-contact-pressed item]))
64-
:extra-text (i18n/label :t/remove-contact)
65-
:context item
66-
:accessibility-label :mark-as-untrustworthy
67-
:button-text (i18n/label :t/mark-as-untrusted-button)
68-
:on-press (fn []
69-
(rf/dispatch [:hide-bottom-sheet])
70-
(rf/dispatch
71-
[:contact/mark-as-untrusted
72-
public-key primary-name]))}])}]}))
49+
(fn [_ [{:keys [public-key] :as contact}]]
50+
(let [name (profile.utils/displayed-name contact)]
51+
{:dispatch
52+
[:show-bottom-sheet
53+
{:content (fn []
54+
[confirmation-drawer/confirmation-drawer
55+
{:title (i18n/label :t/mark-as-untrusted)
56+
:description (i18n/label :t/mark-as-untrusted-description
57+
{:username (:primary-name contact)})
58+
:extra-action (fn []
59+
(rf/dispatch [:toasts/upsert
60+
{:id :remove-contact
61+
:type :positive
62+
:text (->> (i18n/label
63+
:t/removed-from-contacts)
64+
(string/lower-case)
65+
(str name " "))}])
66+
(rf/dispatch [:contact.ui/remove-contact-pressed contact]))
67+
:extra-text (i18n/label :t/remove-contact)
68+
:context contact
69+
:accessibility-label :mark-as-untrustworthy
70+
:button-text (i18n/label :t/mark-as-untrusted-button)
71+
:on-press (fn []
72+
(rf/dispatch [:hide-bottom-sheet])
73+
(rf/dispatch
74+
[:contact/mark-as-untrusted
75+
public-key name]))}])}]})))

0 commit comments

Comments
 (0)