Skip to content

Commit

Permalink
fixup! WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
cammellos committed May 26, 2020
1 parent a17acde commit 7112a6e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
19 changes: 13 additions & 6 deletions src/status_im/subs.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -1574,20 +1574,27 @@
(fn [[contact] _]
(contact.db/added? contact)))

(re-frame/reg-sub
:contacts/raw-contact-name-by-identity
(fn [[_ identity] _]
[(re-frame/subscribe [:contacts/contact-by-identity identity])])
(fn [[db-contact] [_ identity]]
(if (and (:ens-verified db-contact) (seq (:name db-contact)))
(str "@" (:name db-contact))
(:alias db-contact))))

(re-frame/reg-sub
:contacts/contact-name-by-identity
(fn [[_ identity] _]
[(re-frame/subscribe [:contacts/contact-by-identity identity])
[(re-frame/subscribe [:contacts/raw-contact-name-by-identity identity])
(re-frame/subscribe [:multiaccount])])
(fn [[db-contact current-multiaccount] [_ identity]]
(fn [[contact-name current-multiaccount] [_ identity]]
(let [me? (= (:public-key current-multiaccount) identity)]
(if me?
(or (:preferred-name current-multiaccount)
(gfycat/generate-gfy identity))
(if (and (:ens-verified db-contact) (seq (:name db-contact)))
(str "@" (:name db-contact))
(or (:alias db-contact)
(gfycat/generate-gfy identity)))))))
(or contact-name
(gfycat/generate-gfy identity))))))

(re-frame/reg-sub
:messages/quote-info
Expand Down
8 changes: 4 additions & 4 deletions src/status_im/ui/screens/chat/message/message.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,9 @@
(i18n/label :t/status-sent)])
nil)))

(defview message-author-name [from]
(letsubs [contact-name [:contacts/contact-name-by-identity from]]
(chat.utils/format-author contact-name style/message-author-name-container)))
(defview message-author-name [from alias]
(letsubs [contact-name [:contacts/raw-contact-name-by-identity from]]
(chat.utils/format-author (or contact-name alias) style/message-author-name-container)))

(defn message-press-handlers [{:keys [outgoing from content-type content] :as message}]
(let [pack (get-in content [:sticker :pack])]
Expand Down Expand Up @@ -260,7 +260,7 @@
(when display-username?
[react/touchable-opacity {:style style/message-author-touchable
:on-press #(re-frame/dispatch [:chat.ui/show-profile from])}
[message-author-name from]])
[message-author-name from alias]])
;;MESSAGE CONTENT
content]]
; delivery status
Expand Down

0 comments on commit 7112a6e

Please sign in to comment.