[#11152] Resolve self mentions in group chat

This commit is contained in:
Roman Volosovskyi 2020-09-17 15:59:16 +03:00
parent b43f9e0dfd
commit 80faac0ca7
No known key found for this signature in database
GPG Key ID: 0238A4B5ECEE70DE
2 changed files with 23 additions and 9 deletions

View File

@ -26,7 +26,7 @@
nil)]
(reduce
(fn [acc {:keys [alias public-key identicon name]}]
(assoc acc alias
(assoc acc public-key
{:alias alias
:identicon identicon
:public-key public-key
@ -34,15 +34,23 @@
{}
group-contacts))
:else users)]
:else users)
{:keys [name preferred-name public-key photo-path]}
(:multiaccount db)]
(reduce
(fn [acc [key {:keys [alias name identicon]}]]
(let [name (utils/safe-replace name ".stateofus.eth" "")]
(assoc acc alias {:alias alias
:name (or name alias)
:identicon identicon
:public-key key})))
chat-specific-suggestions
(assoc acc key
{:alias alias
:name (or name alias)
:identicon identicon
:public-key key})))
(assoc chat-specific-suggestions
public-key
{:alias name
:name (or preferred-name name)
:identicon photo-path
:public-key public-key})
contacts)))
(def ending-chars "[\\s\\.,;:]")

View File

@ -871,8 +871,14 @@
:chats/mentionable-users
:<- [:chats/current-chat]
:<- [:chats/mentionable-contacts]
(fn [[{:keys [users]} contacts]]
(merge users contacts)))
:<- [:multiaccount]
(fn [[{:keys [users]} contacts {:keys [name preferred-name photo-path public-key]}]]
(-> users
(merge contacts)
(assoc public-key {:alias name
:name (or preferred-name name)
:identicon photo-path
:public-key public-key}))))
(re-frame/reg-sub
:chat/mention-suggestions