bug #2270 - wrong username in received discoveries
This commit is contained in:
parent
0ccfefa6c3
commit
7bbd6cc6c6
|
@ -48,63 +48,63 @@
|
|||
[react/text {:style styles/chat-button-text
|
||||
:uppercase? (:uppercase? styles/chat-button-text-case)} (i18n/label :t/chat)]]]])
|
||||
|
||||
(defview discover-list-item [{:keys [message show-separator? current-account]}]
|
||||
(letsubs [{contact-name :name
|
||||
contact-photo-path :photo-path} [:get-in [:contacts/contacts (:whisper-id message)]]]
|
||||
(let [{:keys [name photo-path whisper-id message-id status]} message
|
||||
{account-photo-path :photo-path
|
||||
account-address :public-key
|
||||
account-name :name} current-account
|
||||
me? (= account-address whisper-id)]
|
||||
[react/view
|
||||
[react/view styles/discover-list-item
|
||||
[view/status-view {:id message-id
|
||||
:style styles/discover-item-status-text
|
||||
:status status}]
|
||||
[react/view styles/discover-list-item-second-row
|
||||
[react/view styles/discover-list-item-name-container
|
||||
[react/view styles/discover-list-item-avatar-container
|
||||
[chat-icon/chat-icon
|
||||
(display-image me? account-photo-path contact-photo-path photo-path whisper-id)
|
||||
{:size 24}]]
|
||||
[react/text {:style styles/discover-list-item-name
|
||||
:font :medium
|
||||
:number-of-lines 1}
|
||||
(display-name me? account-name contact-name name whisper-id)]]
|
||||
(defn discover-list-item [{:keys [message show-separator? current-account contacts]}]
|
||||
(let [{contact-name :name
|
||||
contact-photo-path :photo-path} (get contacts (:whisper-id message))
|
||||
{:keys [name photo-path whisper-id message-id status]} message
|
||||
{account-photo-path :photo-path
|
||||
account-address :public-key
|
||||
account-name :name} current-account
|
||||
me? (= account-address whisper-id)]
|
||||
[react/view
|
||||
[react/view styles/discover-list-item
|
||||
[view/status-view {:id message-id
|
||||
:style styles/discover-item-status-text
|
||||
:status status}]
|
||||
[react/view styles/discover-list-item-second-row
|
||||
[react/view styles/discover-list-item-name-container
|
||||
[react/view styles/discover-list-item-avatar-container
|
||||
[chat-icon/chat-icon
|
||||
(display-image me? account-photo-path contact-photo-path photo-path whisper-id)
|
||||
{:size 24}]]
|
||||
[react/text {:style styles/discover-list-item-name
|
||||
:font :medium
|
||||
:number-of-lines 1}
|
||||
(display-name me? account-name contact-name name whisper-id)]]
|
||||
|
||||
(when-not me?
|
||||
(chat-button whisper-id))]
|
||||
(when show-separator?
|
||||
[react/view styles/separator])]])))
|
||||
(when-not me?
|
||||
(chat-button whisper-id))]
|
||||
(when show-separator?
|
||||
[react/view styles/separator])]]))
|
||||
|
||||
;; NOTE(oskarth): Should possibly be merged with discover-list-item-full, but
|
||||
;; there are too many differences between preview item (main screen) and full
|
||||
;; screen, so safer to modify custom styles here without risking regressions.
|
||||
(defview discover-list-item-full [{:keys [message show-separator? current-account]}]
|
||||
(letsubs [{contact-name :name
|
||||
contact-photo-path :photo-path} [:get-in [:contacts/contacts (:whisper-id message)]]]
|
||||
(let [{:keys [name photo-path whisper-id message-id status]} message
|
||||
{account-photo-path :photo-path
|
||||
account-address :public-key
|
||||
account-name :name} current-account
|
||||
me? (= account-address whisper-id)]
|
||||
[react/view
|
||||
[react/view styles/discover-list-item-full ;; XXX: Custom style here
|
||||
[view/status-view {:id message-id
|
||||
:style styles/discover-item-status-text
|
||||
:status status}]
|
||||
[react/view styles/discover-list-item-second-row
|
||||
[react/view styles/discover-list-item-name-container
|
||||
[react/view styles/discover-list-item-avatar-container
|
||||
[chat-icon/chat-icon
|
||||
(display-image me? account-photo-path contact-photo-path photo-path whisper-id)
|
||||
{:size 24}]]
|
||||
[react/text {:style styles/discover-list-item-name
|
||||
:font :medium
|
||||
:number-of-lines 1}
|
||||
(display-name me? account-name contact-name name whisper-id)]]
|
||||
(defn discover-list-item-full [{:keys [message show-separator? current-account contacts]}]
|
||||
(let [{contact-name :name
|
||||
contact-photo-path :photo-path} (get contacts (:whisper-id message))
|
||||
{:keys [name photo-path whisper-id message-id status]} message
|
||||
{account-photo-path :photo-path
|
||||
account-address :public-key
|
||||
account-name :name} current-account
|
||||
me? (= account-address whisper-id)]
|
||||
[react/view
|
||||
[react/view styles/discover-list-item-full ;; XXX: Custom style here
|
||||
[view/status-view {:id message-id
|
||||
:style styles/discover-item-status-text
|
||||
:status status}]
|
||||
[react/view styles/discover-list-item-second-row
|
||||
[react/view styles/discover-list-item-name-container
|
||||
[react/view styles/discover-list-item-avatar-container
|
||||
[chat-icon/chat-icon
|
||||
(display-image me? account-photo-path contact-photo-path photo-path whisper-id)
|
||||
{:size 24}]]
|
||||
[react/text {:style styles/discover-list-item-name
|
||||
:font :medium
|
||||
:number-of-lines 1}
|
||||
(display-name me? account-name contact-name name whisper-id)]]
|
||||
|
||||
(when-not me?
|
||||
(chat-button whisper-id))]]
|
||||
(when show-separator?
|
||||
[react/view styles/separator])])))
|
||||
(when-not me?
|
||||
(chat-button whisper-id))]]
|
||||
(when show-separator?
|
||||
[react/view styles/separator])]))
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
(defview discover-all-hashtags []
|
||||
(letsubs [current-account [:get-current-account]
|
||||
popular-tags [:get-popular-tags 10]
|
||||
contacts [:get-contacts]
|
||||
{:keys [discoveries]} [:get-popular-discoveries 10]] ;uses the tags passed via :discover-search-tags state
|
||||
[react/view styles/all-recent-container
|
||||
[toolbar/toolbar2 {}
|
||||
|
@ -42,4 +43,5 @@
|
|||
[components/discover-list-item-full
|
||||
{:message message
|
||||
:show-separator? (not= (inc i) (count discoveries))
|
||||
:contacts contacts
|
||||
:current-account current-account}]))]]]]))
|
||||
|
|
|
@ -9,7 +9,8 @@
|
|||
(defview discover-all-recent []
|
||||
(letsubs [discoveries [:get-recent-discoveries]
|
||||
tabs-hidden? [:tabs-hidden?]
|
||||
current-account [:get-current-account]]
|
||||
current-account [:get-current-account]
|
||||
contacts [:get-contacts]]
|
||||
[react/view styles/all-recent-container
|
||||
[toolbar/toolbar2 {}
|
||||
toolbar/default-nav-back
|
||||
|
@ -24,4 +25,5 @@
|
|||
[components/discover-list-item-full
|
||||
{:message message
|
||||
:show-separator? (not= (inc i) (count discoveries))
|
||||
:contacts contacts
|
||||
:current-account current-account}]))]]])]))
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
(defview discover-search-results []
|
||||
(letsubs [{:keys [discoveries total]} [:get-popular-discoveries 250]
|
||||
tags [:get :discover-search-tags]
|
||||
contacts [:get-contacts]
|
||||
current-account [:get-current-account]]
|
||||
(let [datasource (to-datasource discoveries)]
|
||||
[react/view styles/discover-tag-container
|
||||
|
@ -39,6 +40,7 @@
|
|||
:renderRow (fn [row _ _]
|
||||
(react/list-item [components/discover-list-item
|
||||
{:message row
|
||||
:current-account current-account}]))
|
||||
:current-account current-account
|
||||
:contacts contacts}]))
|
||||
:renderSeparator render-separator
|
||||
:style styles/status-list-inner}])])))
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
(re-frame/dispatch [:navigate-to :discover-search-results]))))}])
|
||||
|
||||
|
||||
(defview top-status-for-popular-hashtag [{:keys [tag current-account]}]
|
||||
(defview top-status-for-popular-hashtag [{:keys [tag current-account contacts]}]
|
||||
(letsubs [discoveries [:get-popular-discoveries 1 [tag]]]
|
||||
[react/view styles/popular-list-container
|
||||
[react/view styles/row
|
||||
|
@ -65,7 +65,8 @@
|
|||
(str (:total discoveries))]]]
|
||||
[components/discover-list-item {:message (first (:discoveries discoveries))
|
||||
:show-separator? false
|
||||
:current-account current-account}]]))
|
||||
:current-account current-account
|
||||
:contacts contacts}]]))
|
||||
|
||||
(defview popular-hashtags-preview [{:keys [contacts current-account]}]
|
||||
(letsubs [popular-tags [:get-popular-tags 10]]
|
||||
|
@ -85,7 +86,7 @@
|
|||
:current-account current-account}])]
|
||||
[empty-section :empty-hashtags :t/no-hashtags-discovered-title :t/no-hashtags-discovered-body])])))
|
||||
|
||||
(defn recent-statuses-preview [current-account discoveries]
|
||||
(defn recent-statuses-preview [{:keys [current-account contacts discoveries]}]
|
||||
(let [has-content? (seq discoveries)]
|
||||
[react/view styles/recent-statuses-preview-container
|
||||
[components/title :t/recent :t/all #(re-frame/dispatch [:navigate-to :discover-all-recent]) has-content?]
|
||||
|
@ -98,7 +99,8 @@
|
|||
[react/view styles/recent-statuses-preview-content
|
||||
[components/discover-list-item {:message discovery
|
||||
:show-separator? false
|
||||
:current-account current-account}]])]
|
||||
:current-account current-account
|
||||
:contacts contacts}]])]
|
||||
[empty-section :empty-recent :t/no-statuses-discovered :t/no-statuses-discovered-body])]))
|
||||
|
||||
(def public-chats-mock-data
|
||||
|
@ -147,7 +149,9 @@
|
|||
[toolbar-view (and current-view?
|
||||
(= show-search :discover)) search-text]
|
||||
[react/scroll-view styles/list-container
|
||||
[recent-statuses-preview current-account discoveries]
|
||||
[recent-statuses-preview {:contacts contacts
|
||||
:current-account current-account
|
||||
:discoveries discoveries}]
|
||||
[popular-hashtags-preview {:contacts contacts
|
||||
:current-account current-account}]
|
||||
[all-dapps/preview all-dapps]
|
||||
|
|
Loading…
Reference in New Issue