fix ens name turns into public key while editing message (#14149)
This commit is contained in:
parent
509b8bf3e1
commit
ac9fb2fe4d
|
@ -185,7 +185,7 @@
|
|||
[alias name nickname]))
|
||||
|
||||
(defn add-searchable-phrases-to-contact
|
||||
[{:keys [alias name added? blocked? identicon public-key nickname]} community-chat?]
|
||||
[{:keys [alias name added? blocked? identicon public-key nickname ens-verified]} community-chat?]
|
||||
(when (and alias
|
||||
(not (string/blank? alias))
|
||||
(or name
|
||||
|
@ -194,11 +194,12 @@
|
|||
community-chat?)
|
||||
(not blocked?))
|
||||
(add-searchable-phrases
|
||||
{:alias alias
|
||||
:name (or (utils/safe-replace name ".stateofus.eth" "") alias)
|
||||
:identicon identicon
|
||||
:nickname nickname
|
||||
:public-key public-key})))
|
||||
{:alias alias
|
||||
:name (or (and ens-verified (utils/safe-replace name ".stateofus.eth" "")) alias)
|
||||
:identicon identicon
|
||||
:nickname nickname
|
||||
:ens-verified ens-verified
|
||||
:public-key public-key})))
|
||||
|
||||
(defn mentionable-contacts [contacts]
|
||||
(reduce
|
||||
|
|
|
@ -218,16 +218,23 @@
|
|||
as arguments and returns new fx. Always clear all validation messages."
|
||||
{:events [:chat.ui.input/set-chat-input-text]}
|
||||
[{:keys [db] :as cofx} text chat-id]
|
||||
(let [text-with-mentions (mentions/->input-field text)
|
||||
contacts (:contacts db)
|
||||
hydrated-mentions (map (fn [[t mention :as e]]
|
||||
(if (= t :mention)
|
||||
[:mention (str "@" (multiaccounts/displayed-name
|
||||
(or (get contacts mention)
|
||||
{:public-key mention})))]
|
||||
e)) text-with-mentions)
|
||||
info (mentions/->info hydrated-mentions)]
|
||||
{:set-input-text [chat-id text]
|
||||
(let [text-with-mentions (mentions/->input-field text)
|
||||
all-contacts (:contacts/contacts db)
|
||||
chat (get-in db [:chats chat-id])
|
||||
current-multiaccount (:multiaccount db)
|
||||
mentionable-users (mentions/get-mentionable-users
|
||||
chat all-contacts current-multiaccount nil)
|
||||
hydrated-mentions (map
|
||||
(fn [[t mention :as e]]
|
||||
(if (= t :mention)
|
||||
(let [mention (multiaccounts/displayed-name
|
||||
(get mentionable-users mention))]
|
||||
[:mention (if (string/starts-with? mention "@")
|
||||
mention (str "@" mention))])
|
||||
e)) text-with-mentions)
|
||||
info (mentions/->info hydrated-mentions)
|
||||
new-text (string/join (map second hydrated-mentions))]
|
||||
{:set-input-text [chat-id new-text]
|
||||
:db
|
||||
(-> db
|
||||
(assoc-in [:chats/cursor chat-id] (:mention-end info))
|
||||
|
|
Loading…
Reference in New Issue