Hide community channels when hide channels option is enabled
This commit is contained in:
parent
1948c11508
commit
c86cdf9ac8
|
@ -83,7 +83,8 @@
|
|||
:lastClockValue :last-clock-value
|
||||
:invitationAdmin :invitation-admin
|
||||
:profile :profile-public-key
|
||||
:muteTill :muted-till})
|
||||
:muteTill :muted-till
|
||||
:hideIfPermissionsNotMet :hide-if-permissions-not-met?})
|
||||
rpc->type
|
||||
unmarshal-members
|
||||
(update :last-message #(when % (messages/<-rpc %)))
|
||||
|
@ -110,7 +111,8 @@
|
|||
:unviewed-messages-count (.-unviewedMessagesCount chat)
|
||||
:unviewed-mentions-count (.-unviewedMentionsCount chat)
|
||||
:last-message {:content {:text (.-text chat)
|
||||
:parsed-text (types/js->clj (.-parsedText chat))
|
||||
:parsed-text (types/js->clj (.-parsedText
|
||||
chat))
|
||||
:response-to (.-responseTo chat)}
|
||||
:content-type (.-contentType chat)
|
||||
:community-id (.-contentCommunityId chat)
|
||||
|
@ -123,7 +125,8 @@
|
|||
:profile-public-key (.-profile chat)
|
||||
:highlight (.-highlight chat)
|
||||
:active (.-active chat)
|
||||
:members (types/js->clj (.-members chat))}
|
||||
:members (types/js->clj (.-members chat))
|
||||
:hide-if-permissions-not-met (.-hideIfPermissionsNotMet chat)}
|
||||
rpc->type
|
||||
unmarshal-members))
|
||||
|
||||
|
|
|
@ -29,8 +29,9 @@
|
|||
(-> v
|
||||
(assoc :token-gated? (:tokenGated v)
|
||||
:can-post? (:canPost v)
|
||||
:can-view? (:canView v))
|
||||
(dissoc :canPost :tokenGated :canView)
|
||||
:can-view? (:canView v)
|
||||
:hide-if-permissions-not-met? (:hideIfPermissionsNotMet v))
|
||||
(dissoc :canPost :tokenGated :canView :hideIfPermissionsNotMet)
|
||||
(update :members walk/stringify-keys))))
|
||||
{}
|
||||
chats))
|
||||
|
|
|
@ -243,7 +243,8 @@
|
|||
emoji
|
||||
can-view?
|
||||
can-post?
|
||||
token-gated?]}]]
|
||||
token-gated?
|
||||
hide-if-permissions-not-met?]}]]
|
||||
(let [category-id (if (seq categoryID) categoryID constants/empty-category-id)
|
||||
{:keys [unviewed-messages-count
|
||||
unviewed-mentions-count
|
||||
|
@ -259,6 +260,9 @@
|
|||
:collapsed? (get collapsed-categories
|
||||
category-id)
|
||||
:chats [])))
|
||||
locked? (when token-gated?
|
||||
(and (not can-view?)
|
||||
(not can-post?)))
|
||||
categorized-chat {:name name
|
||||
:emoji emoji
|
||||
:muted? muted
|
||||
|
@ -268,9 +272,8 @@
|
|||
:can-post? can-post?
|
||||
;; NOTE: this is a troolean nil->no permissions, true->no access, false
|
||||
;; -> has access
|
||||
:locked? (when token-gated?
|
||||
(and (not can-view?)
|
||||
(not can-post?)))
|
||||
:locked? locked?
|
||||
:hide-if-permissions-not-met? (and hide-if-permissions-not-met? locked?)
|
||||
:id id}]
|
||||
(update-in acc-with-category [category-id :chats] conj categorized-chat))))
|
||||
|
||||
|
@ -292,7 +295,12 @@
|
|||
(reduce reduce-fn {})
|
||||
(sort-by (comp :position second))
|
||||
(map (fn [[k v]]
|
||||
[k (update v :chats #(sort-by :position %))])))]
|
||||
[k
|
||||
(-> v
|
||||
(update :chats #(sort-by :position %))
|
||||
(update :chats
|
||||
#(filter (comp not :hide-if-permissions-not-met?)
|
||||
%)))])))]
|
||||
categories-and-chats)))
|
||||
|
||||
(re-frame/reg-sub
|
||||
|
|
Loading…
Reference in New Issue