send correct username in public group chat message and show it

This commit is contained in:
Roman Volosovskyi 2018-01-24 15:03:46 +02:00
parent 5ecdb174e2
commit c4151534fb
No known key found for this signature in database
GPG Key ID: 37135489EAE4B2D7
2 changed files with 4 additions and 3 deletions

View File

@ -34,11 +34,12 @@
(defn- send-message (defn- send-message
[{:keys [web3 network-status local-storage chats] [{:keys [web3 network-status local-storage chats]
:contacts/keys [contacts] :contacts/keys [contacts]
:accounts/keys [accounts current-account-id]
:as db} :as db}
{:keys [message-type content from chat-id to] :as message}] {:keys [message-type content from chat-id to] :as message}]
(let [{:keys [dapp? fcm-token]} (get contacts chat-id) (let [{:keys [dapp? fcm-token]} (get contacts chat-id)
{:keys [public-key private-key]} (get chats chat-id) {:keys [public-key private-key]} (get chats chat-id)
sender-name (get-in contacts [from :name])] sender-name (get-in accounts [current-account-id :name])]
;; whenever we are sending message to DApp, we are assuming it's a status bot, ;; whenever we are sending message to DApp, we are assuming it's a status bot,
;; so we are just calling jail `on-message-send` function ;; so we are just calling jail `on-message-send` function
(when message (when message

View File

@ -24,12 +24,12 @@
(def window-width (:width (react/get-dimensions "window"))) (def window-width (:width (react/get-dimensions "window")))
(defview message-author-name [{:keys [outgoing from] :as message}] (defview message-author-name [{:keys [outgoing from username] :as message}]
(letsubs [current-account [:get-current-account] (letsubs [current-account [:get-current-account]
incoming-name [:contact-name-by-identity from]] incoming-name [:contact-name-by-identity from]]
(when-let [name (if outgoing (when-let [name (if outgoing
(:name current-account) (:name current-account)
(or incoming-name (gfycat/generate-gfy from)))] (or incoming-name username (gfycat/generate-gfy from)))]
[react/text {:style style/author} name]))) [react/text {:style style/author} name])))
(defview message-content-status [] (defview message-content-status []