Skip to content

Commit 46665ab

Browse files
committed
Decline contact request option
1 parent cf7984d commit 46665ab

File tree

2 files changed

+35
-23
lines changed

2 files changed

+35
-23
lines changed

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

Lines changed: 34 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -46,30 +46,41 @@
4646
:on-error #(log/error "failed remove contact trust status" % contact-id)}]}))
4747

4848
(rf/reg-event-fx :contact/mark-as-untrusted-sheet
49-
(fn [_ [{:keys [public-key] :as contact}]]
50-
(let [name (profile.utils/displayed-name contact)]
49+
(fn [_ [{:keys [public-key contact-request-state] :as contact}]]
50+
(let [name (profile.utils/displayed-name contact)
51+
contact? (= contact-request-state
52+
constants/contact-request-state-mutual)
53+
request? (= contact-request-state
54+
constants/contact-request-state-received)]
5155
{:dispatch
5256
[:show-bottom-sheet
5357
{:content (fn []
5458
[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]))}])}]})))
59+
(merge {:title (i18n/label :t/mark-as-untrusted)
60+
:description (i18n/label :t/mark-as-untrusted-description
61+
{:username (:primary-name contact)})
62+
:context contact
63+
:accessibility-label :mark-as-untrustworthy
64+
:button-text (i18n/label :t/mark-as-untrusted-button)
65+
:on-press (fn []
66+
(rf/dispatch [:hide-bottom-sheet])
67+
(rf/dispatch
68+
[:contact/mark-as-untrusted
69+
public-key name]))}
70+
(cond
71+
contact?
72+
{:extra-action (fn []
73+
(rf/dispatch [:toasts/upsert
74+
{:id :remove-contact
75+
:type :positive
76+
:text (->> (i18n/label
77+
:t/removed-from-contacts)
78+
(string/lower-case)
79+
(str name " "))}])
80+
(rf/dispatch [:contact.ui/remove-contact-pressed contact]))
81+
:extra-text (i18n/label :t/remove-contact)}
82+
request?
83+
{:extra-action (fn []
84+
(rf/dispatch [:activity-center.contact-requests/decline
85+
public-key]))
86+
:extra-text (i18n/label :t/decline-contact-request)}))])}]})))

translations/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -756,6 +756,7 @@
756756
"dec": "Dec",
757757
"decimals": "Decimals",
758758
"decline": "Decline",
759+
"decline-contact-request": "Decline contact request",
759760
"declined": "Declined",
760761
"decryption-failed-content": "An error occured decrypting your data. You might need to erase your old data and generate a new account. Tap “Apply” to erase or “Cancel” to try again",
761762
"default": "Default",

0 commit comments

Comments
 (0)