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