Skip to content

Commit d7242f1

Browse files
jo-mutulisesmac
andauthored
fix(chats): Last message overlapped by the composer when a message is pinned (#20606)
* fixed overlapping last message by the composer when there is a pinned message * prevent a user who is not a member of a community from pinning or unpinning channel messages --------- Co-authored-by: Ulises M <[email protected]>
1 parent fa4ea06 commit d7242f1

File tree

5 files changed

+17
-6
lines changed

5 files changed

+17
-6
lines changed

src/status_im/contexts/chat/group_details/view.cljs

+1-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
item])))))
5151

5252
(defn add-manage-members
53-
[{:keys [scroll-enabled? on-scroll]}]
53+
[{:keys [on-scroll]}]
5454
(let [theme (quo.theme/use-theme)
5555
selected-participants (rf/sub [:group-chat/selected-participants])
5656
deselected-members (rf/sub [:group-chat/deselected-members])
@@ -74,7 +74,6 @@
7474
(i18n/label (if admin? :t/manage-members :t/add-members))]
7575
[gesture/section-list
7676
{:key-fn :title
77-
:scroll-enabled @scroll-enabled?
7877
:on-scroll on-scroll
7978
:sticky-section-headers-enabled false
8079
:sections (rf/sub [:contacts/grouped-by-first-letter])

src/status_im/contexts/chat/messenger/messages/drawers/view.cljs

+3-2
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
[{:keys [outgoing content pinned-by outgoing-status deleted? deleted-for-me? content-type
9898
bridge-message]
9999
:as message-data}
100-
{:keys [able-to-send-message? community? can-delete-message-for-everyone?
100+
{:keys [able-to-send-message? community? community-member? can-delete-message-for-everyone?
101101
message-pin-enabled group-chat group-admin?]}]
102102
(concat
103103
(when (and outgoing
@@ -131,7 +131,8 @@
131131
:id :copy}])
132132
;; pinning images are temporarily disabled
133133
(when (and message-pin-enabled
134-
(not= content-type constants/content-type-image))
134+
(not= content-type constants/content-type-image)
135+
(or community-member? (not community?)))
135136
[{:type :main
136137
:on-press #(pin-message message-data)
137138
:label (i18n/label (if pinned-by

src/status_im/contexts/chat/messenger/messages/list/style.cljs

+7
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
[react-native.reanimated :as reanimated]
66
[status-im.contexts.chat.messenger.messages.constants :as messages.constants]))
77

8+
(def permission-context-height 46)
9+
810
(defn keyboard-avoiding-container
911
[theme]
1012
{:flex 1
@@ -73,3 +75,8 @@
7375
(reanimated/apply-animations-to-style
7476
{:top top}
7577
{:row-gap 16}))
78+
79+
(defn permission-context-sheet
80+
[margin-bottom?]
81+
{:flex 3 ;; Pushes composer to bottom
82+
:margin-bottom (when margin-bottom? permission-context-height)})

src/status_im/contexts/chat/messenger/messages/list/view.cljs

+4-2
Original file line numberDiff line numberDiff line change
@@ -400,16 +400,18 @@
400400
{:keys [keyboard-shown]} (hooks/use-keyboard)
401401
{window-height :height} (rn/get-window)
402402
context (rf/sub [:chats/current-chat-message-list-view-context])
403+
able-to-send-message? (:able-to-send-message? context)
403404
messages (rf/sub [:chats/raw-chat-messages-stream chat-id])
405+
margin-bottom? (and community-channel? (not able-to-send-message?))
404406
recording? (rf/sub [:chats/recording?])]
405-
[rn/view {:style {:flex 3}} ;; Pushes composer to bottom
407+
[rn/view {:style (style/permission-context-sheet margin-bottom?)}
406408
[rn/view {:style {:flex-shrink 1}} ;; Keeps flat list on top
407409
[reanimated/flat-list
408410
{:key-fn list-key-fn
409411
:ref list-ref
410412
:bounces false
411413
:header [:<>
412-
[list-header insets (:able-to-send-message? context)]
414+
[list-header insets able-to-send-message?]
413415
(when (= (:chat-type chat) constants/private-group-chat-type)
414416
[list-group-chat-header chat])]
415417
:footer [list-footer

src/status_im/subs/chats.cljs

+2
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@
228228
community? (some? current-community)
229229
group-admin? (contains? admins current-public-key)
230230
community-admin? (get current-community :admin false)
231+
community-member? (get current-community :is-member? false)
231232

232233
message-pin-enabled
233234
(cond public? false
@@ -247,6 +248,7 @@
247248
:chat-id chat-id
248249
:in-pinned-view? (boolean in-pinned-view?)
249250
:able-to-send-message? able-to-send-message?
251+
:community-member? community-member?
250252
:message-pin-enabled message-pin-enabled
251253
:can-delete-message-for-everyone? can-delete-message-for-everyone?})))
252254

0 commit comments

Comments
 (0)