[mentions] Open profile tab instead of user profile view on pressing own mention

This commit is contained in:
Roman Volosovskyi 2020-09-07 18:34:17 +03:00
parent 89ad4f59d0
commit 72daf93a75
No known key found for this signature in database
GPG Key ID: 0238A4B5ECEE70DE
2 changed files with 12 additions and 1 deletions

View File

@ -282,6 +282,17 @@
(i18n/label :cooldown/warning-message) (i18n/label :cooldown/warning-message)
#()))) #())))
(fx/defn show-profile-without-adding-contact
{:events [:chat.ui/show-profile-without-adding-contact]}
[{:keys [db] :as cofx} identity]
(let [my-public-key (get-in db [:multiaccount :public-key])]
(if (= my-public-key identity)
(navigation/navigate-to-cofx cofx :my-profile nil)
(fx/merge
cofx
{:db (assoc db :contacts/identity identity)}
(navigation/navigate-to-cofx :profile nil)))))
(fx/defn show-profile (fx/defn show-profile
{:events [:chat.ui/show-profile]} {:events [:chat.ui/show-profile]}
[cofx identity] [cofx identity]

View File

@ -90,7 +90,7 @@
outgoing colors/mention-outgoing outgoing colors/mention-outgoing
:else colors/mention-incoming)} :else colors/mention-incoming)}
:on-press (when-not (= content-type constants/content-type-system-text) :on-press (when-not (= content-type constants/content-type-system-text)
#(re-frame/dispatch [:chat.ui/show-profile literal]))} #(re-frame/dispatch [:chat.ui/show-profile-without-adding-contact literal]))}
[mention-element literal]]) [mention-element literal]])
"status-tag" "status-tag"
(conj acc [react/text-class (conj acc [react/text-class