fix pinned message for community channels (#14885)
This commit is contained in:
parent
55caf0230e
commit
d16baca64f
|
@ -217,7 +217,8 @@
|
|||
:text (i18n/label :t/update-to-see-sticker {"locale" "en"})})))
|
||||
|
||||
(rf/defn send-edited-message
|
||||
[{:keys [db] :as cofx} text {:keys [message-id quoted-message]}]
|
||||
[{:keys [db] :as cofx} text {:keys [message-id quoted-message chat-id]}]
|
||||
(let [pinned-message (get-in db [:pin-messages chat-id message-id])]
|
||||
(rf/merge
|
||||
cofx
|
||||
{:json-rpc/call [{:method "wakuext_editMessage"
|
||||
|
@ -229,8 +230,13 @@
|
|||
constants/content-type-text)}]
|
||||
:js-response true
|
||||
:on-error #(log/error "failed to edit message " %)
|
||||
:on-success #(re-frame/dispatch [:sanitize-messages-and-process-response %])}]}
|
||||
(cancel-message-edit)))
|
||||
:on-success (fn [result]
|
||||
(re-frame/dispatch [:sanitize-messages-and-process-response
|
||||
result])
|
||||
(when pinned-message
|
||||
(re-frame/dispatch [:pin-message/load-pin-messages
|
||||
chat-id])))}]}
|
||||
(cancel-message-edit))))
|
||||
|
||||
(rf/defn send-current-message
|
||||
"Sends message from current chat input"
|
||||
|
|
|
@ -64,5 +64,5 @@
|
|||
:accessory :text
|
||||
:accessory-text (count pinned-messages)
|
||||
:chevron true
|
||||
:on-press #(re-frame/dispatch [:chat.ui/navigate-to-pinned-messages
|
||||
:on-press #(re-frame/dispatch [:bottom-sheet/show-sheet :pinned-messages-list
|
||||
chat-id])}]])]))))
|
||||
|
|
|
@ -100,7 +100,7 @@
|
|||
:accessory :text
|
||||
:accessory-text pin-count
|
||||
:disabled (zero? pin-count)
|
||||
:on-press #(re-frame/dispatch [:chat.ui/navigate-to-pinned-messages public-key])
|
||||
:on-press #(re-frame/dispatch [:bottom-sheet/show-sheet :pinned-messages-list public-key])
|
||||
:chevron true}])
|
||||
|
||||
(defn nickname-settings
|
||||
|
|
|
@ -215,7 +215,8 @@
|
|||
:accessory :text
|
||||
:accessory-text (count pinned-messages)
|
||||
:chevron true
|
||||
:on-press #(re-frame/dispatch [:chat.ui/navigate-to-pinned-messages chat-id])}]
|
||||
:on-press #(re-frame/dispatch [:bottom-sheet/show-sheet :pinned-messages-list
|
||||
chat-id])}]
|
||||
(when member?
|
||||
[quo/list-item
|
||||
{:theme :negative
|
||||
|
|
|
@ -324,12 +324,6 @@
|
|||
(rf/dispatch [:bottom-sheet/hide])
|
||||
(rf/dispatch [:chat.ui/remove-chat chat-id]))}})
|
||||
|
||||
(rf/defn navigate-to-user-pinned-messages
|
||||
"Takes coeffects map and chat-id, returns effects necessary for navigation and preloading data"
|
||||
{:events [:chat.ui/navigate-to-pinned-messages]}
|
||||
[cofx chat-id]
|
||||
(navigation/navigate-to cofx :chat-pinned-messages {:chat-id chat-id}))
|
||||
|
||||
(rf/defn navigate-to-horizontal-images
|
||||
{:events [:chat.ui/navigate-to-horizontal-images]}
|
||||
[cofx messages index]
|
||||
|
|
|
@ -10,13 +10,12 @@
|
|||
(def list-key-fn #(or (:message-id %) (:value %)))
|
||||
|
||||
(defn message-render-fn
|
||||
[{:keys [whisper-timestamp message-id chat-id] :as message}
|
||||
[{:keys [whisper-timestamp] :as message}
|
||||
_
|
||||
{:keys [group-chat public? community? current-public-key show-input? edit-enabled]}]
|
||||
;; TODO (flexsurfer) probably we don't want reactions here
|
||||
(let [message-content-sub (get-in (rf/sub [:chats/chat-messages chat-id]) [message-id :content])]
|
||||
[message/message-with-reactions
|
||||
(assoc message :content message-content-sub)
|
||||
message
|
||||
{:group-chat group-chat
|
||||
:public? public?
|
||||
:community? community?
|
||||
|
@ -26,12 +25,12 @@
|
|||
:in-pinned-view? true
|
||||
:pinned true
|
||||
:timestamp-str (datetime/timestamp->time whisper-timestamp)
|
||||
:edit-enabled edit-enabled}]))
|
||||
:edit-enabled edit-enabled}])
|
||||
|
||||
(defn pinned-messages-list
|
||||
[chat-id]
|
||||
(let [pinned-messages (vec (vals (rf/sub [:chats/pinned chat-id])))
|
||||
current-chat (rf/sub [:chats/current-chat])
|
||||
current-chat (rf/sub [:chat-by-id chat-id])
|
||||
community (rf/sub [:communities/community (:community-id current-chat)])]
|
||||
[rn/view {:accessibility-label :pinned-messages-list}
|
||||
;; TODO (flexsurfer) this should be a component in quo2
|
||||
|
|
Loading…
Reference in New Issue