Don't make inability to unfurl url a user's problem
Signed-off-by: Volodymyr Kozieiev <vkjr.sp@gmail.com>
This commit is contained in:
parent
61105e15f6
commit
a91bdfb047
|
@ -23,16 +23,17 @@
|
|||
{::json-rpc/call [{:method (json-rpc/call-ext-method "getLinkPreviewData")
|
||||
:params [link]
|
||||
:on-success #(re-frame/dispatch [::cache-link-preview-data link %])
|
||||
:on-error #(log/error "Can't get preview data for " link)}]}))
|
||||
:on-error #(re-frame/dispatch [::cache-link-preview-data
|
||||
link
|
||||
{:error (str "Can't get preview data for " link)}])}]}))
|
||||
|
||||
(fx/defn cache-link-preview-data
|
||||
{:events [::cache-link-preview-data]}
|
||||
[{{:keys [multiaccount]} :db :as cofx} site {:keys [error] :as data}]
|
||||
(when-not error
|
||||
[{{:keys [multiaccount]} :db :as cofx} site data]
|
||||
(multiaccounts.update/optimistic
|
||||
cofx
|
||||
:link-previews-cache
|
||||
(assoc (get multiaccount :link-previews-cache {}) site data))))
|
||||
(assoc (get multiaccount :link-previews-cache {}) site data)))
|
||||
|
||||
(fx/defn should-suggest-link-preview
|
||||
{:events [::should-suggest-link-preview]}
|
||||
|
|
|
@ -59,13 +59,13 @@
|
|||
|
||||
(defview link-preview-loader [link outgoing]
|
||||
(letsubs [cache [:link-preview/cache]]
|
||||
(let [{:keys [site title thumbnailUrl] :as preview-data} (get cache link)]
|
||||
(let [{:keys [site title thumbnailUrl error] :as preview-data} (get cache link)]
|
||||
(if (not preview-data)
|
||||
(do
|
||||
(re-frame/dispatch
|
||||
[::link-preview/load-link-preview-data link])
|
||||
nil)
|
||||
|
||||
(when-not error
|
||||
[react/touchable-highlight
|
||||
{:on-press #(when (and (security/safe-link? link))
|
||||
(re-frame/dispatch
|
||||
|
@ -81,7 +81,7 @@
|
|||
[quo/text {:size :small
|
||||
:color :secondary
|
||||
:style styles/link-preview-site}
|
||||
site]]]))))
|
||||
site]]])))))
|
||||
|
||||
(defview link-preview-wrapper [links outgoing]
|
||||
(letsubs
|
||||
|
|
Loading…
Reference in New Issue