From 4759624734f4b07124c4d6ce832ceca713f5acc9 Mon Sep 17 00:00:00 2001 From: Icaro Motta Date: Tue, 3 Oct 2023 16:45:22 -0300 Subject: [PATCH] Use correct field in JSON RPC response --- .../chat/composer/link_preview/events.cljs | 2 +- .../composer/link_preview/events_test.cljs | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/status_im2/contexts/chat/composer/link_preview/events.cljs b/src/status_im2/contexts/chat/composer/link_preview/events.cljs index 5e1ce194588..806ee9dff0c 100644 --- a/src/status_im2/contexts/chat/composer/link_preview/events.cljs +++ b/src/status_im2/contexts/chat/composer/link_preview/events.cljs @@ -82,7 +82,7 @@ (rf/defn unfurl-parsed-urls-success {:events [:link-preview/unfurl-parsed-urls-success]} - [{:keys [db]} request-id new-previews] + [{:keys [db]} request-id {new-previews :linkPreviews}] (when (= request-id (get-in db [:chat/link-previews :request-id])) (let [new-previews (map data-store.messages/<-link-preview-rpc new-previews) curr-previews (get-in db [:chat/link-previews :unfurled]) diff --git a/src/status_im2/contexts/chat/composer/link_preview/events_test.cljs b/src/status_im2/contexts/chat/composer/link_preview/events_test.cljs index ddff60844e7..6ea012fbb65 100644 --- a/src/status_im2/contexts/chat/composer/link_preview/events_test.cljs +++ b/src/status_im2/contexts/chat/composer/link_preview/events_test.cljs @@ -139,7 +139,7 @@ {:request-id request-id :unfurled [] :cache {}}}}] - (is (nil? (events/unfurl-parsed-urls-success cofx "banana" [preview-github]))))) + (is (nil? (events/unfurl-parsed-urls-success cofx "banana" {:linkPreviews [preview-github]}))))) (testing "reconciles new previews with existing ones" (let [cofx {:db {:chat/link-previews @@ -147,9 +147,10 @@ :unfurled [preview-github {:url url-gitlab :loading? true}] :cache {url-github preview-github}}}} - {db :db} (events/unfurl-parsed-urls-success cofx - request-id - [preview-gitlab])] + {db :db} (events/unfurl-parsed-urls-success + cofx + request-id + {:linkPreviews [preview-gitlab]})] (is (= {:chat/link-previews {:request-id request-id :unfurled [preview-github preview-gitlab] @@ -165,10 +166,11 @@ preview-youtube {:url url-gitlab :loading? true}] :cache {(:url preview-youtube) preview-youtube}}}} - {db :db} (events/unfurl-parsed-urls-success cofx - request-id - [preview-github - preview-youtube])] + {db :db} (events/unfurl-parsed-urls-success + cofx + request-id + {:linkPreviews [preview-github + preview-youtube]})] (is (= {:chat/link-previews {:request-id request-id :unfurled [preview-github preview-youtube]