Fix deleted chats behavior
This commit is contained in:
parent
80cb7ada68
commit
69b6fb40b4
|
@ -289,20 +289,29 @@
|
|||
(handlers/merge-fx cofx (transport/unsubscribe-from-chat chat-id)))))
|
||||
|
||||
(handlers/register-handler-fx
|
||||
:remove-chat
|
||||
:leave-chat-and-navigate-home
|
||||
[re-frame/trim-v]
|
||||
(fn [cofx [chat-id]]
|
||||
(handlers/merge-fx cofx
|
||||
(models/remove-chat chat-id)
|
||||
(navigation/replace-view :home)
|
||||
(remove-transport chat-id))))
|
||||
|
||||
(handlers/register-handler-fx
|
||||
:leave-group-chat?
|
||||
[re-frame/trim-v]
|
||||
(fn [_ [chat-id]]
|
||||
{:show-confirmation {:title (i18n/label :t/leave-confirmation)
|
||||
:content (i18n/label :t/leave-group-chat-confirmation)
|
||||
:confirm-button-text (i18n/label :t/leave)
|
||||
:on-accept #(re-frame/dispatch [:leave-chat-and-navigate-home chat-id])}}))
|
||||
|
||||
(handlers/register-handler-fx
|
||||
:remove-chat-and-navigate-home
|
||||
[re-frame/trim-v]
|
||||
(fn [cofx [chat-id]]
|
||||
(handlers/merge-fx cofx
|
||||
(models/remove-chat chat-id)
|
||||
(remove-transport chat-id)
|
||||
(navigation/replace-view :home))))
|
||||
|
||||
(handlers/register-handler-fx
|
||||
|
@ -351,15 +360,6 @@
|
|||
(navigate-to-chat random-id {})
|
||||
(transport.message/send (group-chat/GroupAdminUpdate. chat-name selected-contacts) random-id)))))
|
||||
|
||||
(handlers/register-handler-fx
|
||||
:leave-group-chat?
|
||||
[re-frame/trim-v]
|
||||
(fn [_ [chat-id]]
|
||||
{:show-confirmation {:title (i18n/label :t/leave-confirmation)
|
||||
:content (i18n/label :t/leave-group-chat-confirmation)
|
||||
:confirm-button-text (i18n/label :t/leave)
|
||||
:on-accept #(re-frame/dispatch [:remove-chat-and-navigate-home chat-id])}}))
|
||||
|
||||
(handlers/register-handler-fx
|
||||
:show-profile
|
||||
[re-frame/trim-v]
|
||||
|
|
|
@ -101,8 +101,6 @@
|
|||
(cond-> {:db (-> db
|
||||
(update :chats dissoc chat-id)
|
||||
(update :deleted-chats (fnil conj #{}) chat-id))}
|
||||
(or group-chat debug?)
|
||||
(assoc :data-store/delete-messages chat-id)
|
||||
debug?
|
||||
(assoc :data-store/delete-chat chat-id)
|
||||
(not debug?)
|
||||
|
|
|
@ -111,14 +111,10 @@
|
|||
(let [{:keys [chats deleted-chats current-public-key]} db
|
||||
{:keys [messages not-loaded-message-ids]} (get chats chat-id)]
|
||||
(when (not= from current-public-key)
|
||||
(if (group-message? message)
|
||||
(not (or (get deleted-chats chat-id)
|
||||
(get messages message-id)
|
||||
(get not-loaded-message-ids message-id)))
|
||||
(not (or (get messages message-id)
|
||||
(get not-loaded-message-ids message-id)
|
||||
(and (get deleted-chats chat-id)
|
||||
(get-stored-message message-id))))))))
|
||||
(not (or (get messages message-id)
|
||||
(get not-loaded-message-ids message-id)
|
||||
(and (get deleted-chats chat-id)
|
||||
(get-stored-message message-id)))))))
|
||||
|
||||
(defn message-seen-by? [message user-pk]
|
||||
(= :seen (get-in message [:user-statuses user-pk])))
|
||||
|
|
|
@ -55,8 +55,7 @@
|
|||
(do (re-frame/dispatch [:update-contact! dapp])
|
||||
(respond {:type :ok
|
||||
:text "The DApp or bot has been updated."}))
|
||||
(do (re-frame/dispatch [:add-contacts [dapp]])
|
||||
(re-frame/dispatch [:open-chat-with-contact dapp])
|
||||
(do (re-frame/dispatch [:open-chat-with-contact dapp])
|
||||
(respond {:type :ok
|
||||
:text "The DApp or bot has been added."}))))
|
||||
(respond {:type :error
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
|
||||
(views/defview home-list-item [[home-item-id home-item]]
|
||||
(views/letsubs [swiped? [:delete-swipe-position home-item-id]]
|
||||
(let [delete-action (if (:chat-id home-item) :remove-chat :remove-browser)
|
||||
(let [delete-action (if (:chat-id home-item) :remove-chat-and-navigate-home :remove-browser)
|
||||
inner-item-view (if (:chat-id home-item)
|
||||
inner-item/home-list-chat-item-inner-view
|
||||
inner-item/home-list-browser-item-inner-view)
|
||||
|
|
Loading…
Reference in New Issue