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)
Sat, Nov 2, 2:28 PM
Unknown Object (File)
Tue, Oct 22, 3:44 PM
Unknown Object (File)
Tue, Oct 22, 3:44 PM
Unknown Object (File)
Tue, Oct 22, 3:18 PM
Unknown Object (File)
Mon, Oct 21, 8:11 AM
Unknown Object (File)
Mon, Oct 21, 2:01 AM
Unknown Object (File)
Mon, Oct 21, 2:01 AM
Unknown Object (File)
Mon, Oct 21, 2:01 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
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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!