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

View File

@ -72,9 +72,15 @@
:chats/home-list-chats :chats/home-list-chats
:<- [:chats/chats] :<- [:chats/chats]
:<- [:chats-home-list] :<- [:chats-home-list]
(fn [[chats active-chats]] :<- [:multiaccount/public-key]
(fn [[chats active-chats my-public-key]]
(reduce #(if-let [item (get chats %2)] (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) %1)
[] []
active-chats))) active-chats)))