[#12422] Can't navigate to community channel from community invite view

This commit is contained in:
andrey 2021-08-06 12:12:34 +02:00
parent 8cf87dbbbd
commit f7cf172761
No known key found for this signature in database
GPG Key ID: 89B67245FD2F0272
2 changed files with 12 additions and 10 deletions

View File

@ -123,7 +123,8 @@
[quo/separator] [quo/separator]
[quo/button {:on-press #(re-frame/dispatch [:navigate-to [quo/button {:on-press #(re-frame/dispatch [:navigate-to
:community :community
{:community-id (:id community)}]) {:from-chat true
:community-id (:id community)}])
:type :secondary} :type :secondary}
(i18n/label :t/view)]])) (i18n/label :t/view)]]))

View File

@ -139,21 +139,21 @@
:color :secondary} :color :secondary}
text]]) text]])
(defn community-chat-item [{:keys [chat-id] :as home-item}] (defn community-chat-item [{:keys [chat-id] :as home-item} _ _ {:keys [from-chat]}]
[inner-item/home-list-item [inner-item/home-list-item
;; We want communities to behave as public chats when it comes to ;; We want communities to behave as public chats when it comes to
;; unread indicator ;; unread indicator
(assoc home-item :public? true) (assoc home-item :public? true)
{:on-press (fn [] {:on-press (fn []
(re-frame/dispatch [:dismiss-keyboard]) (re-frame/dispatch [:dismiss-keyboard])
(re-frame/dispatch [:chat.ui/navigate-to-chat chat-id true]) (re-frame/dispatch [:chat.ui/navigate-to-chat chat-id (not from-chat)])
(re-frame/dispatch [:search/home-filter-changed nil]) (re-frame/dispatch [:search/home-filter-changed nil])
(re-frame/dispatch [:accept-all-activity-center-notifications-from-chat chat-id])) (re-frame/dispatch [:accept-all-activity-center-notifications-from-chat chat-id]))
:on-long-press #(re-frame/dispatch [:bottom-sheet/show-sheet :on-long-press #(re-frame/dispatch [:bottom-sheet/show-sheet
{:content (fn [] {:content (fn []
[sheets/actions home-item])}])}]) [sheets/actions home-item])}])}])
(defn categories-accordion [community-id chats categories edit] (defn categories-accordion [community-id chats categories edit data]
[rn/view {:padding-bottom 8} [rn/view {:padding-bottom 8}
(for [{:keys [name id]} (vals categories)] (for [{:keys [name id]} (vals categories)]
^{:key (str "cat" name id)} ^{:key (str "cat" name id)}
@ -181,10 +181,10 @@
[inner-item/home-list-item [inner-item/home-list-item
(assoc chat :public? true)]]] (assoc chat :public? true)]]]
^{:key (str "chat" chat id)} ^{:key (str "chat" chat id)}
[community-chat-item chat]))]}] [community-chat-item chat nil nil data]))]}]
[quo/separator]])]) [quo/separator]])])
(defn community-chat-list [community-id categories edit] (defn community-chat-list [community-id categories edit from-chat]
(let [chats (<sub [:chats/categories-by-community-id community-id])] (let [chats (<sub [:chats/categories-by-community-id community-id])]
(if (and (empty? categories) (empty? chats)) (if (and (empty? categories) (empty? chats))
[blank-page (i18n/label :t/welcome-community-blank-message)] [blank-page (i18n/label :t/welcome-community-blank-message)]
@ -193,8 +193,9 @@
:content-container-style {:padding-bottom 8} :content-container-style {:padding-bottom 8}
:keyboard-should-persist-taps :always :keyboard-should-persist-taps :always
:data (get chats "") :data (get chats "")
:render-data {:from-chat from-chat}
:render-fn community-chat-item :render-fn community-chat-item
:header [categories-accordion community-id chats categories edit] :header [categories-accordion community-id chats categories edit {:from-chat from-chat}]
:footer [rn/view {:height 68}]}]))) :footer [rn/view {:height 68}]}])))
(defn channel-preview-item [{:keys [id color name]}] (defn channel-preview-item [{:keys [id color name]}]
@ -252,10 +253,10 @@
images images
(not= (:access permissions) constants/community-no-membership-access) (not= (:access permissions) constants/community-no-membership-access)
(count members)]}] (count members)]}]
[community-chat-list id categories true]])))) [community-chat-list id categories true false]]))))
(defn community [] (defn community []
(let [{:keys [community-id]} (<sub [:get-screen-params])] (let [{:keys [community-id from-chat]} (<sub [:get-screen-params])]
(fn [] (fn []
(let [{:keys [id chats name images members permissions color joined can-request-access? (let [{:keys [id chats name images members permissions color joined can-request-access?
can-join? requested-to-join-at admin categories] can-join? requested-to-join-at admin categories]
@ -279,7 +280,7 @@
{:content (fn [] {:content (fn []
[community-actions community])}])}])}] [community-actions community])}])}])}]
(if joined (if joined
[community-chat-list id categories false] [community-chat-list id categories false from-chat]
[community-channel-preview-list id chats]) [community-channel-preview-list id chats])
(when admin (when admin
[components.plus-button/plus-button [components.plus-button/plus-button