issue: https://linear.app/comm/issue/ENG-2794/make-it-possible-to-display-only-chats-from-a-given-community-in-the
Since D6645 the calendar filters reducer reacts to updateCalendarCommunityFilter and clearCalendarCommunityFilter actions. We want to be able to extract the thread IDs based on the filters these actions have set.
Details
Dispatch updateCalendarCommunityFilter and clearCalendarCommunityFilter actions, log the value returned by filteredCommunityThreadIDsSelector. Check that it is correct. Check that it is only
possible to add an event for a chat in the selected community (in the web app) - this is a result of updating onScreenThreadInfos that is used by ThreadPickerModal
Diff Detail
- Repository
- rCOMM Comm
- Lint
No Lint Coverage - Unit
No Test Coverage
Event Timeline
lib/selectors/calendar-filter-selectors.js | ||
---|---|---|
36–52 ↗ | (On Diff #21580) | This is very similar to filteredThreadIDs, it just filters out a different calendarThreadFilterTypes type, but I'm not sure if i should merge them. |
Mooving the selector to web/, since state.communityFilter is only present on web/ now
web/selectors/thread-selectors.js | ||
---|---|---|
135 ↗ | (On Diff #22259) | This type could be skipped since it's obvious this will be the same as the return type of the entire selector but I saw in codebase versions with/without type in last callback so deffering to you |
web/selectors/thread-selectors.js | ||
---|---|---|
127 ↗ | (On Diff #22283) | This name is a bit confusing. Maybe we can explain what is being filtered and by which condition, e.q. filteredThreadIDsByCommunitySelector? We can even go one step further and avoid saying that we're filtering. |
Actually this selector should take into account if thread is in Filter List (threadInFilterList), because we want it to tell us about the chats in the community, that the user wants to see calendar events of. Now it just returns all chats from that community that the user has in their threadStore, which is not right.
I also believe this should be moved to web/selectors/calendar-selectors.js, to be clear that this is related to calendar stuff
web/selectors/calendar-selectors.js | ||
---|---|---|
38 ↗ | (On Diff #22296) | This was added relative to what had been accepted |
web/selectors/calendar-selectors.js | ||
---|---|---|
38 ↗ | (On Diff #22296) | I'm not sure if it is a good idea to include this check here. Now the function name is no longer relevant as we're returning only a subset of threads from the community. I think this function should be reverted to the previous state and the additional filtering could be performed where it is used. We can also consider renaming this function so that it is more explicit about the additional filtering. |
web/selectors/calendar-selectors.js | ||
---|---|---|
38 ↗ | (On Diff #22296) | I moved the function to calendar-selectors.js to be clear that this has to do with calendar, and not simply returning threads of a community. So I'd rather rename the function to be more clear, and do the filtering here. I don't want to have to do this in the reducer, I want this function to abstract that from the reducer. |
web/selectors/calendar-selectors.js | ||
---|---|---|
38 ↗ | (On Diff #22296) | Makes sense! |