[#14230] Load newly received messages on reopening chat (ISSUE 1)

This commit is contained in:
Roman Volosovskyi 2022-10-27 11:13:11 +02:00
parent 1941591110
commit f29ed58445
No known key found for this signature in database
GPG Key ID: 0238A4B5ECEE70DE
2 changed files with 9 additions and 1 deletions

View File

@ -265,6 +265,7 @@
[{db :db :as cofx} chat-id from-switcher?]
(fx/merge cofx
{:db (assoc db :current-chat-id chat-id)}
(offload-messages chat-id)
(preload-chat-data chat-id)
(navigation2/navigate-to-nav2 :chat chat-id nil from-switcher?)))
@ -496,4 +497,4 @@
(update-in [:chats chat-id :unviewed-messages-count]
#(max (- % count) 0))
(update-in [:chats chat-id :unviewed-mentions-count]
#(max (- % countWithMentions) 0)))})
#(max (- % countWithMentions) 0)))})

View File

@ -84,3 +84,10 @@
:group-chat true}
"opened" {}
"1-1" {}}})
(deftest navigate-to-chat-nav2
(let [chat-id "test_chat"
db {:pagination-info {chat-id {:all-loaded? true}}}]
(testing "Pagination info should be reset on navigation"
(let [res (chat/navigate-to-chat-nav2 {:db db} chat-id false)]
(is (nil? (get-in res [:db :pagination-info chat-id :all-loaded?])))))))