Revert "Prevent #links to work except in community chats and allow redirection from channel to another when clicked (#15069)"

This reverts commit bc5f0ccda6.
This commit is contained in:
Andrea Maria Piana 2023-02-20 10:10:40 +00:00
parent bc5f0ccda6
commit 172bf66436
No known key found for this signature in database
GPG Key ID: AA6CCA6DE0E06424
3 changed files with 12 additions and 43 deletions

View File

@ -198,15 +198,6 @@
%) %)
(re-frame/dispatch [::failed-to-leave %]))}]})) (re-frame/dispatch [::failed-to-leave %]))}]}))
(rf/defn status-tag-pressed
{:events [:communities/status-tag-pressed]}
[{:keys [db]} community-id literal]
(let [current-chat-id (:current-chat-id db)
{:keys [id]} (some #(when (= (:name %) literal) %)
(vals (get-in db [:communities community-id :chats])))]
(when-not (= current-chat-id (str community-id id))
{:dispatch [:chat/navigate-to-chat (str community-id id)]})))
(rf/defn fetch (rf/defn fetch
[_] [_]
{:json-rpc/call [{:method "wakuext_communities" {:json-rpc/call [{:method "wakuext_communities"

View File

@ -38,8 +38,7 @@
(rf/sub [:contacts/contact-name-by-identity from])) (rf/sub [:contacts/contact-name-by-identity from]))
(defn render-inline (defn render-inline
[_message-text content-type acc {:keys [type literal destination]} [_message-text content-type acc {:keys [type literal destination]}]
community-id]
(case type (case type
"" ""
(conj acc literal) (conj acc literal)
@ -81,10 +80,9 @@
"status-tag" "status-tag"
(conj acc (conj acc
[rn/text [rn/text
(when community-id {:style {:color :blue
{:style {:color :blue :text-decoration-line :underline}
:text-decoration-line :underline} :on-press #(rf/dispatch [:chat.ui/start-public-chat literal])}
:on-press #(rf/dispatch [:communities/status-tag-pressed community-id literal])})
"#" "#"
literal]) literal])
@ -96,20 +94,13 @@
;; TEXT ;; TEXT
(defn render-block (defn render-block
[{:keys [content content-type edited-at in-popover?]} acc [{:keys [content content-type edited-at in-popover?]} acc
{:keys [type ^js literal children]} {:keys [type ^js literal children]}]
community-id]
(case type (case type
"paragraph" "paragraph"
(conj acc (conj acc
(reduce (reduce
(fn [acc e] (fn [acc e] (render-inline (:text content) content-type acc e))
(render-inline (:text content)
content-type
acc
e
community-id))
[rn/text (style/text-style content-type in-popover?)] [rn/text (style/text-style content-type in-popover?)]
(conj (conj
children children
@ -130,16 +121,11 @@
acc)) acc))
(defn render-parsed-text (defn render-parsed-text
[{:keys [content chat-id] [{:keys [content] :as message-data}]
:as message-data}] (reduce (fn [acc e]
(let [community-id (rf/sub [:community-id-by-chat-id chat-id])] (render-block message-data acc e))
(reduce (fn [acc e] [:<>]
(render-block message-data (:parsed-text content)))
acc
e
community-id))
[:<>]
(:parsed-text content))))
(defn quoted-message (defn quoted-message
[{:keys [message-id chat-id]} reply pin?] [{:keys [message-id chat-id]} reply pin?]
@ -248,7 +234,7 @@
[rn/view style/status-container [rn/view style/status-container
[rn/text {:style (style/status-text)} [rn/text {:style (style/status-text)}
(reduce (reduce
(fn [acc e] (render-inline (:text content) content-type acc e nil)) (fn [acc e] (render-inline (:text content) content-type acc e))
[rn/text {:style (style/status-text)}] [rn/text {:style (style/status-text)}]
(-> content :parsed-text peek :children))]]) (-> content :parsed-text peek :children))]])

View File

@ -20,14 +20,6 @@
(fn [chats [_ chat-id]] (fn [chats [_ chat-id]]
(get chats chat-id))) (get chats chat-id)))
(re-frame/reg-sub
:community-id-by-chat-id
:<- [:chats/chats]
(fn [chats [_ chat-id]]
(-> chats
(get chat-id)
:community-id)))
(re-frame/reg-sub (re-frame/reg-sub
:chats/by-community-id :chats/by-community-id
:<- [:chats/chats] :<- [:chats/chats]