Do not show group details when user is not a member of the group (#16134)

This commit is contained in:
Volodymyr Kozieiev 2023-06-07 17:01:50 +01:00 committed by GitHub
parent a5455739c6
commit 5aa91359e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 10 deletions

View File

@ -133,7 +133,7 @@
:chevron? true})))
(defn mark-as-read-entry
[chat-id]
[chat-id needs-divider?]
(entry {:icon :i/correct
:label (i18n/label :t/mark-as-read)
:on-press #(mark-all-read-action chat-id)
@ -141,7 +141,7 @@
:accessibility-label :mark-as-read
:sub-label nil
:chevron? false
:add-divider? true}))
:add-divider? needs-divider?}))
(defn clear-history-entry
[chat-id]
@ -403,8 +403,8 @@
(delete-chat-entry item inside-chat?))])
(defn notification-actions
[{:keys [chat-id group-chat public?]} inside-chat?]
[(mark-as-read-entry chat-id)
[{:keys [chat-id group-chat public?]} inside-chat? needs-divider?]
[(mark-as-read-entry chat-id needs-divider?)
(mute-chat-entry chat-id)
(notifications-entry false)
(when inside-chat?
@ -433,15 +433,17 @@
[quo/action-drawer
[[(view-profile-entry chat-id)
(edit-nickname-entry chat-id)]
(notification-actions item inside-chat?)
(notification-actions item inside-chat? false)
(destructive-actions item inside-chat?)]])
(defn private-group-chat-actions
[item inside-chat?]
[quo/action-drawer
[(group-actions item inside-chat?)
(notification-actions item inside-chat?)
(destructive-actions item inside-chat?)]])
(let [show-group-actions? (:group-chat-member? item)]
[(when show-group-actions?
(group-actions item inside-chat?))
(notification-actions item inside-chat? show-group-actions?)
(destructive-actions item inside-chat?)])])
(defn contact-actions
[{:keys [public-key] :as contact} {:keys [chat-id admin?] :as extra-data}]

View File

@ -72,9 +72,15 @@
:chats/home-list-chats
:<- [:chats/chats]
:<- [:chats-home-list]
(fn [[chats active-chats]]
:<- [:multiaccount/public-key]
(fn [[chats active-chats my-public-key]]
(reduce #(if-let [item (get chats %2)]
(conj %1 item)
(let [group-chat-member? (and (chat.events/group-chat? item)
(group-chats.db/member? my-public-key item))]
(conj %1
(assoc item
:group-chat-member?
group-chat-member?)))
%1)
[]
active-chats)))