Skip to content

Commit

Permalink
fix: only display spectated communities in opened tab (#21548)
Browse files Browse the repository at this point in the history
This change resolves an issue with un-opened, joined, and pending communities being visible inside the "opened" communities tab. With this change, the "opened" community tab will only display spectated (opened) communities that have not been joined or pending to be joined.
  • Loading branch information
seanstrom authored Nov 5, 2024
1 parent 03ec410 commit ca22b67
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/status_im/subs/communities.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -183,18 +183,15 @@

(def memo-communities-stack-items (atom nil))

(defn- merge-opened-communities
[{:keys [joined pending] :as assorted-communities}]
(update assorted-communities :opened concat joined pending))

(defn- group-communities-by-status
[requests
{:keys [id]
:as community}]
(cond
(:joined community) :joined
(boolean (get requests id)) :pending
:else :opened))
(:spectated community) :opened
:else :other))

(re-frame/reg-sub
:communities/grouped-by-status
Expand All @@ -216,7 +213,6 @@
;; any key.
(map #(dissoc % :members :chats :token-permissions :tokens-metadata))
(group-by #(group-communities-by-status requests %))
merge-opened-communities
(map (fn [[k v]]
{k (sort-by (fn [{:keys [requested-to-join-at last-opened-at
joined-at]}]
Expand Down

0 comments on commit ca22b67

Please sign in to comment.