Skip to content

Commit

Permalink
Do not show group details when user is not a member of the group (#16134
Browse files Browse the repository at this point in the history
)
  • Loading branch information
vkjr authored and codemaster115 committed Jun 7, 2023
1 parent 419768a commit 6b5e8c6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
18 changes: 10 additions & 8 deletions src/status_im2/common/home/actions/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -133,15 +133,15 @@
: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)
:danger? false
:accessibility-label :mark-as-read
:sub-label nil
:chevron? false
:add-divider? true}))
:add-divider? needs-divider?}))

(defn clear-history-entry
[chat-id]
Expand Down Expand Up @@ -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?
Expand Down Expand Up @@ -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}]
Expand Down
10 changes: 8 additions & 2 deletions src/status_im2/subs/chat/chats.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down

0 comments on commit 6b5e8c6

Please sign in to comment.