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)
Wed, Apr 10, 5:06 AM
Unknown Object (File)
Sun, Apr 7, 6:48 PM
Unknown Object (File)
Thu, Apr 4, 10:11 PM
Unknown Object (File)
Thu, Apr 4, 10:11 PM
Unknown Object (File)
Thu, Apr 4, 10:11 PM
Unknown Object (File)
Thu, Apr 4, 10:11 PM
Unknown Object (File)
Thu, Apr 4, 10:11 PM
Unknown Object (File)
Thu, Apr 4, 10:09 PM
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!