Page MenuHomePhabricator

[web] Add a selector for getting the number of unnreads in the selected community
ClosedPublic

Authored by inka on Mar 7 2023, 4:54 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Nov 25, 6:16 PM
Unknown Object (File)
Mon, Nov 25, 4:40 PM
Unknown Object (File)
Tue, Nov 19, 7:44 AM
Unknown Object (File)
Tue, Nov 19, 7:44 AM
Unknown Object (File)
Tue, Nov 19, 7:44 AM
Unknown Object (File)
Tue, Nov 19, 7:44 AM
Unknown Object (File)
Tue, Nov 19, 7:44 AM
Unknown Object (File)
Tue, Nov 19, 7:39 AM
Subscribers

Details

Summary

issue: https://linear.app/comm/issue/ENG-3179/make-the-badge-on-the-chat-tab-responsive-to-drawer-selection
We want the badge on the chat tab to display the number of unreads for the selected community.
This selector is almost identical to unreadCount selector that was used here before, for getting the number of all unreads, it only adds the (!communityID || communityID === threadInfo.community) condition

when we navigate to Calendar the number on the Chat tab is still supposed to display the number for the community selected in the Chat tab

Test Plan

run web app, checked that the number on the badge takes into account only chats from the current community

Diff Detail

Repository
rCOMM Comm
Branch
inka/filter_chats
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

inka requested review of this revision.Mar 7 2023, 5:09 AM

Rebase above message editing

michal added inline comments.
web/selectors/thread-selectors.js
133 ↗(On Diff #24793)

Do you think it would make sense to put it in lib, near unreadCount?

This revision is now accepted and ready to land.Apr 12 2023, 5:26 AM
web/selectors/thread-selectors.js
133 ↗(On Diff #24793)

communityPickerStore this is based on is only in webs state, so I cannot put it in lib

A more high-level explanation is that we only "select a community" on web. We have no such behaviour on native, because the UI is different and it would be difficult to have it make sense to the user. So a selector that selects the number of unreads in a selected community doesn't make sense there.

web/selectors/thread-selectors.js
133 ↗(On Diff #24793)

That makes sense, thanks for explaining!