@planningcenter/chat-react-native 4.7.1-rc.0 → 4.8.0-qa-staging.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/conversations/app_update_banner.d.ts +2 -0
- package/build/components/conversations/app_update_banner.d.ts.map +1 -0
- package/build/components/conversations/app_update_banner.js +52 -0
- package/build/components/conversations/app_update_banner.js.map +1 -0
- package/build/components/conversations/conversation_actions.d.ts.map +1 -1
- package/build/components/conversations/conversation_actions.js +333 -193
- package/build/components/conversations/conversation_actions.js.map +1 -1
- package/build/components/conversations/conversation_preview.d.ts.map +1 -1
- package/build/components/conversations/conversation_preview.js +106 -91
- package/build/components/conversations/conversation_preview.js.map +1 -1
- package/build/components/conversations/conversations.d.ts.map +1 -1
- package/build/components/conversations/conversations.js +63 -56
- package/build/components/conversations/conversations.js.map +1 -1
- package/build/components/conversations/conversations_blank_state.d.ts +2 -1
- package/build/components/conversations/conversations_blank_state.d.ts.map +1 -1
- package/build/components/conversations/conversations_blank_state.js +71 -39
- package/build/components/conversations/conversations_blank_state.js.map +1 -1
- package/build/components/conversations/hidden_indicator.d.ts +4 -0
- package/build/components/conversations/hidden_indicator.d.ts.map +1 -0
- package/build/components/conversations/hidden_indicator.js +52 -0
- package/build/components/conversations/hidden_indicator.js.map +1 -0
- package/build/components/conversations/hidden_results_footer.d.ts +2 -0
- package/build/components/conversations/hidden_results_footer.d.ts.map +1 -0
- package/build/components/conversations/hidden_results_footer.js +34 -0
- package/build/components/conversations/hidden_results_footer.js.map +1 -0
- package/build/components/display/toast.d.ts +3 -0
- package/build/components/display/toast.d.ts.map +1 -0
- package/build/components/display/toast.js +224 -0
- package/build/components/display/toast.js.map +1 -0
- package/build/components/group_conversation_list.d.ts.map +1 -1
- package/build/components/group_conversation_list.js +1 -0
- package/build/components/group_conversation_list.js.map +1 -1
- package/build/components/primitive/banner_primitive.js +7 -3
- package/build/components/primitive/banner_primitive.js.map +1 -1
- package/build/contexts/api_provider.d.ts.map +1 -1
- package/build/contexts/api_provider.js +2 -0
- package/build/contexts/api_provider.js.map +1 -1
- package/build/contexts/chat_context.d.ts +0 -2
- package/build/contexts/chat_context.d.ts.map +1 -1
- package/build/contexts/chat_context.js +16 -93
- package/build/contexts/chat_context.js.map +1 -1
- package/build/contexts/conversations_context.d.ts +3 -1
- package/build/contexts/conversations_context.d.ts.map +1 -1
- package/build/contexts/conversations_context.js +39 -31
- package/build/contexts/conversations_context.js.map +1 -1
- package/build/contexts/session_context.d.ts.map +1 -1
- package/build/contexts/session_context.js +3 -0
- package/build/contexts/session_context.js.map +1 -1
- package/build/hooks/groups/use_group_chat_conversation_payload.d.ts +11 -1
- package/build/hooks/groups/use_group_chat_conversation_payload.d.ts.map +1 -1
- package/build/hooks/groups/use_group_chat_conversation_payload.js +92 -47
- package/build/hooks/groups/use_group_chat_conversation_payload.js.map +1 -1
- package/build/hooks/groups/use_group_members_for_new_conversation.d.ts +33 -25
- package/build/hooks/groups/use_group_members_for_new_conversation.d.ts.map +1 -1
- package/build/hooks/groups/use_group_members_for_new_conversation.js +125 -110
- package/build/hooks/groups/use_group_members_for_new_conversation.js.map +1 -1
- package/build/hooks/groups/use_groups_conversation_create.d.ts.map +1 -1
- package/build/hooks/groups/use_groups_conversation_create.js +39 -31
- package/build/hooks/groups/use_groups_conversation_create.js.map +1 -1
- package/build/hooks/groups/use_groups_proxy.d.ts +2 -0
- package/build/hooks/groups/use_groups_proxy.d.ts.map +1 -0
- package/build/hooks/groups/use_groups_proxy.js +18 -0
- package/build/hooks/groups/use_groups_proxy.js.map +1 -0
- package/build/hooks/use_api.d.ts +6 -0
- package/build/hooks/use_api.d.ts.map +1 -1
- package/build/hooks/use_api.js +8 -5
- package/build/hooks/use_api.js.map +1 -1
- package/build/hooks/use_clear_conversation_filters.d.ts.map +1 -1
- package/build/hooks/use_clear_conversation_filters.js +1 -0
- package/build/hooks/use_clear_conversation_filters.js.map +1 -1
- package/build/hooks/use_conversation.d.ts.map +1 -1
- package/build/hooks/use_conversation.js +1 -1
- package/build/hooks/use_conversation.js.map +1 -1
- package/build/hooks/use_conversation_jolt_events.d.ts.map +1 -1
- package/build/hooks/use_conversation_jolt_events.js +3 -2
- package/build/hooks/use_conversation_jolt_events.js.map +1 -1
- package/build/hooks/use_conversations_actions.d.ts +9 -9
- package/build/hooks/use_conversations_actions.d.ts.map +1 -1
- package/build/hooks/use_conversations_actions.js +12 -7
- package/build/hooks/use_conversations_actions.js.map +1 -1
- package/build/hooks/use_conversations_cache.d.ts +1 -3
- package/build/hooks/use_conversations_cache.d.ts.map +1 -1
- package/build/hooks/use_conversations_cache.js +79 -124
- package/build/hooks/use_conversations_cache.js.map +1 -1
- package/build/hooks/use_conversations_jolt_events.d.ts.map +1 -1
- package/build/hooks/use_conversations_jolt_events.js +47 -20
- package/build/hooks/use_conversations_jolt_events.js.map +1 -1
- package/build/hooks/use_features.d.ts +2 -0
- package/build/hooks/use_features.d.ts.map +1 -1
- package/build/hooks/use_features.js +3 -1
- package/build/hooks/use_features.js.map +1 -1
- package/build/hooks/use_groups.d.ts +6 -0
- package/build/hooks/use_groups.d.ts.map +1 -1
- package/build/hooks/use_groups_groups.d.ts +6 -0
- package/build/hooks/use_groups_groups.d.ts.map +1 -1
- package/build/hooks/use_groups_groups.js +25 -9
- package/build/hooks/use_groups_groups.js.map +1 -1
- package/build/hooks/use_hidden_conversations_count.d.ts +2 -0
- package/build/hooks/use_hidden_conversations_count.d.ts.map +1 -0
- package/build/hooks/use_hidden_conversations_count.js +32 -0
- package/build/hooks/use_hidden_conversations_count.js.map +1 -0
- package/build/hooks/use_hide_conversation.d.ts +108 -0
- package/build/hooks/use_hide_conversation.d.ts.map +1 -0
- package/build/hooks/use_hide_conversation.js +243 -0
- package/build/hooks/use_hide_conversation.js.map +1 -0
- package/build/hooks/use_hide_conversations_enabled.d.ts +2 -0
- package/build/hooks/use_hide_conversations_enabled.d.ts.map +1 -0
- package/build/hooks/use_hide_conversations_enabled.js +18 -0
- package/build/hooks/use_hide_conversations_enabled.js.map +1 -0
- package/build/hooks/use_mark_latest_message_read.d.ts.map +1 -1
- package/build/hooks/use_mark_latest_message_read.js +5 -4
- package/build/hooks/use_mark_latest_message_read.js.map +1 -1
- package/build/hooks/use_new_conversation_from_filter.d.ts.map +1 -1
- package/build/hooks/use_new_conversation_from_filter.js +11 -1
- package/build/hooks/use_new_conversation_from_filter.js.map +1 -1
- package/build/hooks/use_product_analytics.d.ts.map +1 -1
- package/build/hooks/use_product_analytics.js +93 -75
- package/build/hooks/use_product_analytics.js.map +1 -1
- package/build/hooks/use_teams.d.ts +6 -0
- package/build/hooks/use_teams.d.ts.map +1 -1
- package/build/navigation/index.d.ts +5 -0
- package/build/navigation/index.d.ts.map +1 -1
- package/build/navigation/index.js +5 -0
- package/build/navigation/index.js.map +1 -1
- package/build/screens/conversation_actions_screen.d.ts +7 -0
- package/build/screens/conversation_actions_screen.d.ts.map +1 -0
- package/build/screens/conversation_actions_screen.js +89 -0
- package/build/screens/conversation_actions_screen.js.map +1 -0
- package/build/screens/conversation_details_screen.d.ts.map +1 -1
- package/build/screens/conversation_details_screen.js +460 -394
- package/build/screens/conversation_details_screen.js.map +1 -1
- package/build/screens/conversation_filters/components/conversation_filters.d.ts.map +1 -1
- package/build/screens/conversation_filters/components/conversation_filters.js +53 -12
- package/build/screens/conversation_filters/components/conversation_filters.js.map +1 -1
- package/build/screens/conversation_filters/components/rows.d.ts +6 -3
- package/build/screens/conversation_filters/components/rows.d.ts.map +1 -1
- package/build/screens/conversation_filters/components/rows.js +99 -62
- package/build/screens/conversation_filters/components/rows.js.map +1 -1
- package/build/screens/conversation_filters/context/conversation_filter_context.d.ts.map +1 -1
- package/build/screens/conversation_filters/context/conversation_filter_context.js +4 -0
- package/build/screens/conversation_filters/context/conversation_filter_context.js.map +1 -1
- package/build/screens/conversation_filters/filter_types.d.ts +1 -0
- package/build/screens/conversation_filters/filter_types.d.ts.map +1 -1
- package/build/screens/conversation_filters/filter_types.js +1 -0
- package/build/screens/conversation_filters/filter_types.js.map +1 -1
- package/build/screens/conversation_filters/hooks/filters.d.ts +12 -0
- package/build/screens/conversation_filters/hooks/filters.d.ts.map +1 -1
- package/build/screens/conversation_filters/screen_props.d.ts +1 -0
- package/build/screens/conversation_filters/screen_props.d.ts.map +1 -1
- package/build/screens/conversation_filters/screen_props.js.map +1 -1
- package/build/screens/conversation_new/components/groups_form.d.ts.map +1 -1
- package/build/screens/conversation_new/components/groups_form.js +96 -93
- package/build/screens/conversation_new/components/groups_form.js.map +1 -1
- package/build/screens/conversations/components/filter_dropdown_list_header_component.d.ts.map +1 -1
- package/build/screens/conversations/components/filter_dropdown_list_header_component.js +138 -126
- package/build/screens/conversations/components/filter_dropdown_list_header_component.js.map +1 -1
- package/build/screens/conversations/components/list_header_component.d.ts.map +1 -1
- package/build/screens/conversations/components/list_header_component.js +95 -90
- package/build/screens/conversations/components/list_header_component.js.map +1 -1
- package/build/screens/conversations/components/search_list_header_component.d.ts.map +1 -1
- package/build/screens/conversations/components/search_list_header_component.js +100 -95
- package/build/screens/conversations/components/search_list_header_component.js.map +1 -1
- package/build/screens/conversations/conversations_screen.d.ts +1 -0
- package/build/screens/conversations/conversations_screen.d.ts.map +1 -1
- package/build/screens/conversations/conversations_screen.js +47 -21
- package/build/screens/conversations/conversations_screen.js.map +1 -1
- package/build/screens/get_help_screen.d.ts.map +1 -1
- package/build/screens/get_help_screen.js +4 -20
- package/build/screens/get_help_screen.js.map +1 -1
- package/build/screens/index.d.ts +1 -0
- package/build/screens/index.d.ts.map +1 -1
- package/build/screens/index.js +1 -0
- package/build/screens/index.js.map +1 -1
- package/build/types/jolt_events/index.d.ts +2 -0
- package/build/types/jolt_events/index.d.ts.map +1 -1
- package/build/types/jolt_events/index.js.map +1 -1
- package/build/types/jolt_events/person_events.d.ts +9 -0
- package/build/types/jolt_events/person_events.d.ts.map +1 -0
- package/build/types/jolt_events/person_events.js +2 -0
- package/build/types/jolt_events/person_events.js.map +1 -0
- package/build/types/resources/conversation_membership.d.ts +1 -0
- package/build/types/resources/conversation_membership.d.ts.map +1 -1
- package/build/types/resources/conversation_membership.js.map +1 -1
- package/build/types/resources/groups/groups_group_resource.d.ts +1 -1
- package/build/types/resources/groups/groups_group_resource.d.ts.map +1 -1
- package/build/types/resources/groups/groups_group_resource.js.map +1 -1
- package/build/types/resources/groups/groups_membership_resource.d.ts +11 -0
- package/build/types/resources/groups/groups_membership_resource.d.ts.map +1 -0
- package/build/types/resources/groups/groups_membership_resource.js +2 -0
- package/build/types/resources/groups/groups_membership_resource.js.map +1 -0
- package/build/types/resources/groups/index.d.ts +1 -0
- package/build/types/resources/groups/index.d.ts.map +1 -1
- package/build/types/resources/groups/index.js +1 -0
- package/build/types/resources/groups/index.js.map +1 -1
- package/build/utils/jolt/parse_stream_user_event_type.d.ts +3 -0
- package/build/utils/jolt/parse_stream_user_event_type.d.ts.map +1 -0
- package/build/utils/jolt/parse_stream_user_event_type.js +9 -0
- package/build/utils/jolt/parse_stream_user_event_type.js.map +1 -0
- package/build/utils/native_adapters/configuration.d.ts +3 -0
- package/build/utils/native_adapters/configuration.d.ts.map +1 -1
- package/build/utils/native_adapters/configuration.js +3 -0
- package/build/utils/native_adapters/configuration.js.map +1 -1
- package/build/utils/native_adapters/index.d.ts +1 -0
- package/build/utils/native_adapters/index.d.ts.map +1 -1
- package/build/utils/native_adapters/index.js +1 -0
- package/build/utils/native_adapters/index.js.map +1 -1
- package/build/utils/native_adapters/linking.d.ts.map +1 -1
- package/build/utils/native_adapters/linking.js +48 -2
- package/build/utils/native_adapters/linking.js.map +1 -1
- package/build/utils/native_adapters/updates.d.ts +11 -0
- package/build/utils/native_adapters/updates.d.ts.map +1 -0
- package/build/utils/native_adapters/updates.js +8 -0
- package/build/utils/native_adapters/updates.js.map +1 -0
- package/build/utils/product_analytics_token.d.ts +12 -0
- package/build/utils/product_analytics_token.d.ts.map +1 -0
- package/build/utils/product_analytics_token.js +84 -0
- package/build/utils/product_analytics_token.js.map +1 -0
- package/build/utils/request/conversation.d.ts +3 -1
- package/build/utils/request/conversation.d.ts.map +1 -1
- package/build/utils/request/conversation.js +4 -0
- package/build/utils/request/conversation.js.map +1 -1
- package/build/utils/throttled_refresh.d.ts +7 -0
- package/build/utils/throttled_refresh.d.ts.map +1 -0
- package/build/utils/throttled_refresh.js +42 -0
- package/build/utils/throttled_refresh.js.map +1 -0
- package/build/utils/toast_store.d.ts +21 -0
- package/build/utils/toast_store.d.ts.map +1 -0
- package/build/utils/toast_store.js +27 -0
- package/build/utils/toast_store.js.map +1 -0
- package/build/vendor/font_awesome_pro_solid_icons.d.ts +1 -0
- package/build/vendor/font_awesome_pro_solid_icons.d.ts.map +1 -1
- package/build/vendor/font_awesome_pro_solid_icons.js +5 -0
- package/build/vendor/font_awesome_pro_solid_icons.js.map +1 -1
- package/package.json +3 -3
- package/src/__tests__/hooks/use_group_chat_conversation_payload.test.tsx +31 -0
- package/src/__tests__/screens/conversation_filters/components/conversation_filters.test.tsx +6 -0
- package/src/components/conversations/__tests__/app_update_banner.test.tsx +27 -0
- package/src/components/conversations/__tests__/conversation_actions.test.tsx +77 -2
- package/src/components/conversations/__tests__/conversation_preview.test.tsx +29 -0
- package/src/components/conversations/__tests__/conversations.test.tsx +26 -0
- package/src/components/conversations/__tests__/conversations_blank_state.test.tsx +17 -0
- package/src/components/conversations/app_update_banner.tsx +36 -0
- package/src/components/conversations/conversation_actions.tsx +73 -4
- package/src/components/conversations/conversation_preview.tsx +12 -1
- package/src/components/conversations/conversations.tsx +9 -0
- package/src/components/conversations/conversations_blank_state.tsx +18 -0
- package/src/components/conversations/hidden_indicator.tsx +30 -0
- package/src/components/conversations/hidden_results_footer.tsx +25 -0
- package/src/components/display/__tests__/toast.test.tsx +55 -0
- package/src/components/display/toast.tsx +115 -0
- package/src/components/group_conversation_list.tsx +4 -1
- package/src/components/primitive/banner_primitive.tsx +5 -1
- package/src/contexts/api_provider.tsx +2 -0
- package/src/contexts/chat_context.tsx +2 -58
- package/src/contexts/conversations_context.tsx +8 -1
- package/src/contexts/session_context.tsx +3 -0
- package/src/hooks/__tests__/jolt_refresh_throttling.test.tsx +229 -0
- package/src/hooks/__tests__/use_conversations_jolt_events.test.tsx +1 -0
- package/src/hooks/__tests__/use_conversations_mark_read.test.tsx +38 -12
- package/src/hooks/__tests__/use_hide_conversation.test.tsx +189 -0
- package/src/hooks/__tests__/use_mark_latest_message_read.test.tsx +23 -2
- package/src/hooks/__tests__/use_product_analytics.test.tsx +304 -0
- package/src/hooks/groups/use_group_chat_conversation_payload.ts +30 -12
- package/src/hooks/groups/use_group_members_for_new_conversation.ts +49 -18
- package/src/hooks/groups/use_groups_conversation_create.ts +10 -14
- package/src/hooks/groups/use_groups_proxy.ts +6 -0
- package/src/hooks/use_api.ts +2 -1
- package/src/hooks/use_clear_conversation_filters.ts +1 -0
- package/src/hooks/use_conversation.ts +1 -0
- package/src/hooks/use_conversation_jolt_events.ts +2 -1
- package/src/hooks/use_conversations_actions.ts +7 -4
- package/src/hooks/use_conversations_cache.ts +1 -23
- package/src/hooks/use_conversations_jolt_events.ts +24 -10
- package/src/hooks/use_features.ts +2 -0
- package/src/hooks/use_groups_groups.ts +21 -16
- package/src/hooks/use_hidden_conversations_count.ts +14 -0
- package/src/hooks/use_hide_conversation.ts +128 -0
- package/src/hooks/use_hide_conversations_enabled.ts +7 -0
- package/src/hooks/use_mark_latest_message_read.ts +6 -5
- package/src/hooks/use_new_conversation_from_filter.ts +13 -5
- package/src/hooks/use_product_analytics.ts +74 -41
- package/src/navigation/index.tsx +8 -0
- package/src/screens/__tests__/conversation_actions_screen.test.tsx +79 -0
- package/src/screens/__tests__/conversation_details_screen.test.tsx +49 -1
- package/src/screens/conversation_actions_screen.tsx +53 -0
- package/src/screens/conversation_details_screen.tsx +19 -0
- package/src/screens/conversation_filters/__tests__/conversation_filters.test.tsx +42 -0
- package/src/screens/conversation_filters/components/conversation_filters.tsx +22 -3
- package/src/screens/conversation_filters/components/rows.tsx +44 -10
- package/src/screens/conversation_filters/context/conversation_filter_context.tsx +4 -0
- package/src/screens/conversation_filters/filter_types.ts +1 -0
- package/src/screens/conversation_filters/screen_props.ts +1 -0
- package/src/screens/conversation_new/components/groups_form.tsx +11 -9
- package/src/screens/conversations/__tests__/conversations_screen.test.tsx +3 -3
- package/src/screens/conversations/components/__tests__/filter_dropdown_list_header_component.test.tsx +42 -0
- package/src/screens/conversations/components/__tests__/list_header_component.test.tsx +1 -0
- package/src/screens/conversations/components/filter_dropdown_list_header_component.tsx +21 -5
- package/src/screens/conversations/components/list_header_component.tsx +14 -4
- package/src/screens/conversations/components/search_list_header_component.tsx +14 -4
- package/src/screens/conversations/conversations_screen.tsx +12 -1
- package/src/screens/get_help_screen.tsx +4 -18
- package/src/screens/index.ts +1 -0
- package/src/types/jolt_events/index.ts +2 -0
- package/src/types/jolt_events/person_events.ts +16 -0
- package/src/types/resources/conversation_membership.ts +1 -0
- package/src/types/resources/groups/groups_group_resource.ts +1 -1
- package/src/types/resources/groups/groups_membership_resource.ts +10 -0
- package/src/types/resources/groups/index.ts +1 -0
- package/src/utils/__tests__/throttled_refresh.test.ts +101 -0
- package/src/utils/jolt/__tests__/parse_stream_user_event_type.test.ts +27 -0
- package/src/utils/jolt/parse_stream_user_event_type.ts +16 -0
- package/src/utils/native_adapters/__tests__/linking.test.ts +60 -4
- package/src/utils/native_adapters/configuration.ts +5 -0
- package/src/utils/native_adapters/index.ts +1 -0
- package/src/utils/native_adapters/linking.ts +50 -2
- package/src/utils/native_adapters/updates.ts +16 -0
- package/src/utils/product_analytics_token.ts +120 -0
- package/src/utils/request/conversation.ts +6 -0
- package/src/utils/throttled_refresh.ts +62 -0
- package/src/utils/toast_store.ts +45 -0
- package/src/vendor/font_awesome_pro_solid_icons.ts +12 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DefaultTheme, ThemeProvider } from '@react-navigation/native'
|
|
1
|
+
import { DefaultTheme, StackActions, ThemeProvider } from '@react-navigation/native'
|
|
2
2
|
import { QueryClientProvider } from '@tanstack/react-query'
|
|
3
3
|
import { fireEvent, render } from '@testing-library/react-native'
|
|
4
4
|
import React from 'react'
|
|
@@ -68,6 +68,12 @@ jest.mock('../../hooks/use_conversation', () => ({
|
|
|
68
68
|
useConversationUpdate: () => ({ mutate: mockSaveTitle }),
|
|
69
69
|
}))
|
|
70
70
|
|
|
71
|
+
let mockHidden = false
|
|
72
|
+
const mockSetHidden = jest.fn()
|
|
73
|
+
jest.mock('../../hooks/use_hide_conversation', () => ({
|
|
74
|
+
useHideConversation: () => ({ hidden: mockHidden, setHidden: mockSetHidden, isPending: false }),
|
|
75
|
+
}))
|
|
76
|
+
|
|
71
77
|
let mockEnabledFeatures: string[] = []
|
|
72
78
|
jest.mock('../../hooks/use_features', () => ({
|
|
73
79
|
...jest.requireActual('../../hooks/use_features'),
|
|
@@ -303,3 +309,45 @@ describe('ConversationDetailsScreen archive', () => {
|
|
|
303
309
|
expect(mockArchive).not.toHaveBeenCalled()
|
|
304
310
|
})
|
|
305
311
|
})
|
|
312
|
+
|
|
313
|
+
describe('ConversationDetailsScreen hide', () => {
|
|
314
|
+
beforeEach(() => {
|
|
315
|
+
mockConversation = baseConversation
|
|
316
|
+
mockEnabledFeatures = ['ROLLOUT_hide_conversations']
|
|
317
|
+
mockHidden = false
|
|
318
|
+
jest.clearAllMocks()
|
|
319
|
+
})
|
|
320
|
+
|
|
321
|
+
it('hides the row when the flag is off', () => {
|
|
322
|
+
mockEnabledFeatures = []
|
|
323
|
+
const { queryByText } = renderScreen()
|
|
324
|
+
|
|
325
|
+
expect(queryByText('Hide conversation')).toBeNull()
|
|
326
|
+
})
|
|
327
|
+
|
|
328
|
+
it('hides the row for an archived conversation', () => {
|
|
329
|
+
mockConversation = archivedConversation
|
|
330
|
+
const { queryByText } = renderScreen()
|
|
331
|
+
|
|
332
|
+
expect(queryByText('Hide conversation')).toBeNull()
|
|
333
|
+
})
|
|
334
|
+
|
|
335
|
+
it('hides the conversation and returns to the list', () => {
|
|
336
|
+
const { getByText } = renderScreen()
|
|
337
|
+
|
|
338
|
+
fireEvent.press(getByText('Hide conversation'))
|
|
339
|
+
|
|
340
|
+
expect(mockSetHidden).toHaveBeenCalledWith(true)
|
|
341
|
+
expect(mockNavigation.dispatch).toHaveBeenCalledWith(StackActions.popToTop())
|
|
342
|
+
})
|
|
343
|
+
|
|
344
|
+
it('unhides a hidden conversation and stays on the details', () => {
|
|
345
|
+
mockHidden = true
|
|
346
|
+
const { getByText } = renderScreen()
|
|
347
|
+
|
|
348
|
+
fireEvent.press(getByText('Unhide conversation'))
|
|
349
|
+
|
|
350
|
+
expect(mockSetHidden).toHaveBeenCalledWith(false)
|
|
351
|
+
expect(mockNavigation.dispatch).not.toHaveBeenCalled()
|
|
352
|
+
})
|
|
353
|
+
})
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { StaticScreenProps, useNavigation } from '@react-navigation/native'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import { StyleSheet } from 'react-native'
|
|
4
|
+
import FormSheet, { getFormSheetScreenOptions } from '../components/primitive/form_sheet'
|
|
5
|
+
import { useConversation } from '../hooks/use_conversation'
|
|
6
|
+
import { useHideConversation } from '../hooks/use_hide_conversation'
|
|
7
|
+
import { useHideConversationsEnabled } from '../hooks/use_hide_conversations_enabled'
|
|
8
|
+
|
|
9
|
+
export const ConversationActionsScreenOptions = getFormSheetScreenOptions({
|
|
10
|
+
headerTitle: 'Conversation actions',
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
export type ConversationActionsScreenProps = StaticScreenProps<{
|
|
14
|
+
conversation_id: number
|
|
15
|
+
}>
|
|
16
|
+
|
|
17
|
+
export function ConversationActionsScreen({ route }: ConversationActionsScreenProps) {
|
|
18
|
+
const navigation = useNavigation()
|
|
19
|
+
const styles = useStyles()
|
|
20
|
+
const { data: conversation } = useConversation(route.params)
|
|
21
|
+
const { hidden, setHidden, isPending } = useHideConversation({ conversation })
|
|
22
|
+
const hideConversationsEnabled = useHideConversationsEnabled()
|
|
23
|
+
|
|
24
|
+
const handleHidePress = () => {
|
|
25
|
+
setHidden(!hidden)
|
|
26
|
+
navigation.goBack()
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<FormSheet.Root style={styles.formSheetContent}>
|
|
31
|
+
{hideConversationsEnabled && (
|
|
32
|
+
<FormSheet.Action
|
|
33
|
+
onPress={handleHidePress}
|
|
34
|
+
title={hidden ? 'Unhide conversation' : 'Hide conversation'}
|
|
35
|
+
iconName={hidden ? 'general.showEye' : 'general.hideEye'}
|
|
36
|
+
disabled={isPending}
|
|
37
|
+
accessibilityHint={
|
|
38
|
+
hidden
|
|
39
|
+
? 'Shows this conversation in your conversation list again.'
|
|
40
|
+
: 'Hides this conversation from your conversation list.'
|
|
41
|
+
}
|
|
42
|
+
/>
|
|
43
|
+
)}
|
|
44
|
+
</FormSheet.Root>
|
|
45
|
+
)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const useStyles = () =>
|
|
49
|
+
StyleSheet.create({
|
|
50
|
+
formSheetContent: {
|
|
51
|
+
paddingTop: 16,
|
|
52
|
+
},
|
|
53
|
+
})
|
|
@@ -50,6 +50,8 @@ import {
|
|
|
50
50
|
useConversationUpdate,
|
|
51
51
|
} from '../hooks/use_conversation'
|
|
52
52
|
import { availableFeatures, useFeatures } from '../hooks/use_features'
|
|
53
|
+
import { useHideConversation } from '../hooks/use_hide_conversation'
|
|
54
|
+
import { useHideConversationsEnabled } from '../hooks/use_hide_conversations_enabled'
|
|
53
55
|
import { useManualArchivingEnabled } from '../hooks/use_manual_archiving_enabled'
|
|
54
56
|
import { usePreviewAvatarDiameter } from '../hooks/use_preview_avatar_diameter'
|
|
55
57
|
import { useUnarchiveConversationAction } from '../hooks/use_unarchive_conversation_action'
|
|
@@ -115,6 +117,8 @@ export function ConversationDetailsScreen({ route }: ConversationDetailsScreenPr
|
|
|
115
117
|
const granularNotificationsEnabled = featureEnabled(availableFeatures.granular_notifications_ui)
|
|
116
118
|
const customAvatarsEnabled = featureEnabled(availableFeatures.custom_conversation_avatars)
|
|
117
119
|
const manualArchivingEnabled = useManualArchivingEnabled()
|
|
120
|
+
const hideConversationsEnabled = useHideConversationsEnabled()
|
|
121
|
+
const { hidden, setHidden, isPending: isHidePending } = useHideConversation({ conversation })
|
|
118
122
|
const showGenderFilter =
|
|
119
123
|
featureEnabled(availableFeatures.gender_specific_conversations) && !!conversation.genderOption
|
|
120
124
|
const genderLabel = conversation.genderOption ? genderDisplayLabel(conversation.genderOption) : ''
|
|
@@ -130,6 +134,7 @@ export function ConversationDetailsScreen({ route }: ConversationDetailsScreenPr
|
|
|
130
134
|
const canSaveTitle = canUpdate && !emptyTitle
|
|
131
135
|
const canDelete = conversation.memberAbility?.canDelete || false
|
|
132
136
|
const canArchive = manualArchivingEnabled && (conversation.memberAbility?.canArchive || false)
|
|
137
|
+
const canHide = hideConversationsEnabled && !archived
|
|
133
138
|
const isLeader = conversation.memberAbility?.leader || false
|
|
134
139
|
const isDisabled = conversation.disabled ?? false
|
|
135
140
|
const showAdultRequirementNotice = isDisabled && conversation.disabledReason === 'safety_check'
|
|
@@ -231,6 +236,11 @@ export function ConversationDetailsScreen({ route }: ConversationDetailsScreenPr
|
|
|
231
236
|
)
|
|
232
237
|
}, [setArchived])
|
|
233
238
|
|
|
239
|
+
const handleHide = useCallback(() => {
|
|
240
|
+
setHidden(!hidden)
|
|
241
|
+
if (!hidden) navigation.dispatch(StackActions.popToTop())
|
|
242
|
+
}, [hidden, navigation, setHidden])
|
|
243
|
+
|
|
234
244
|
const HeaderTitle = useCallback(
|
|
235
245
|
(props: HeaderTitleProps) => {
|
|
236
246
|
return (
|
|
@@ -354,6 +364,15 @@ export function ConversationDetailsScreen({ route }: ConversationDetailsScreenPr
|
|
|
354
364
|
},
|
|
355
365
|
showBottomBorder: true,
|
|
356
366
|
},
|
|
367
|
+
{
|
|
368
|
+
type: canHide ? SectionTypes.setting : SectionTypes.hidden,
|
|
369
|
+
data: {
|
|
370
|
+
title: hidden ? 'Unhide conversation' : 'Hide conversation',
|
|
371
|
+
disabled: isHidePending,
|
|
372
|
+
onPress: handleHide,
|
|
373
|
+
},
|
|
374
|
+
showBottomBorder: canArchive || canDelete,
|
|
375
|
+
},
|
|
357
376
|
{
|
|
358
377
|
type: canArchive ? SectionTypes.setting : SectionTypes.hidden,
|
|
359
378
|
data: {
|
|
@@ -18,6 +18,14 @@ let mockCanBrowseArchived = false
|
|
|
18
18
|
jest.mock('../../../hooks/use_can_browse_archived_conversations', () => ({
|
|
19
19
|
useCanBrowseArchivedConversations: () => mockCanBrowseArchived,
|
|
20
20
|
}))
|
|
21
|
+
let mockHideEnabled = false
|
|
22
|
+
jest.mock('../../../hooks/use_hide_conversations_enabled', () => ({
|
|
23
|
+
useHideConversationsEnabled: () => mockHideEnabled,
|
|
24
|
+
}))
|
|
25
|
+
let mockHiddenCount = 0
|
|
26
|
+
jest.mock('../../../hooks/use_hidden_conversations_count', () => ({
|
|
27
|
+
useHiddenConversationsCount: () => mockHiddenCount,
|
|
28
|
+
}))
|
|
21
29
|
jest.mock('../../../hooks/use_direct_messages_eligible', () => ({
|
|
22
30
|
useDirectMessagesEligible: () => false,
|
|
23
31
|
}))
|
|
@@ -66,6 +74,7 @@ describe('ConversationFilters archived option', () => {
|
|
|
66
74
|
|
|
67
75
|
expect(view.queryByText('Other')).toBeNull()
|
|
68
76
|
expect(view.queryByText('Archived conversations')).toBeNull()
|
|
77
|
+
expect(view.queryByText('Hidden conversations')).toBeNull()
|
|
69
78
|
})
|
|
70
79
|
|
|
71
80
|
it('offers Archived under Other when the person can browse archived conversations', () => {
|
|
@@ -99,3 +108,36 @@ describe('ConversationFilters archived option', () => {
|
|
|
99
108
|
expect(within(selected).getByText('Archived conversations')).toBeTruthy()
|
|
100
109
|
})
|
|
101
110
|
})
|
|
111
|
+
|
|
112
|
+
describe('ConversationFilters hidden option', () => {
|
|
113
|
+
beforeEach(() => {
|
|
114
|
+
mockSetAppFilter.mockClear()
|
|
115
|
+
mockCanBrowseArchived = false
|
|
116
|
+
mockHideEnabled = true
|
|
117
|
+
mockHiddenCount = 3
|
|
118
|
+
})
|
|
119
|
+
|
|
120
|
+
it('offers Hidden conversations under Other with the hidden count', () => {
|
|
121
|
+
const view = renderFilters()
|
|
122
|
+
|
|
123
|
+
expect(view.getByText('Other')).toBeTruthy()
|
|
124
|
+
expect(view.getByText('Hidden conversations')).toBeTruthy()
|
|
125
|
+
expect(view.getByText('Hidden for just you')).toBeTruthy()
|
|
126
|
+
expect(view.getByTestId('filter-row-count')).toHaveTextContent('3')
|
|
127
|
+
})
|
|
128
|
+
|
|
129
|
+
it('selecting Hidden conversations sets the hidden filter param', () => {
|
|
130
|
+
const view = renderFilters()
|
|
131
|
+
|
|
132
|
+
fireEvent.press(view.getByText('Hidden conversations'))
|
|
133
|
+
|
|
134
|
+
expect(mockSetAppFilter).toHaveBeenCalledWith({ show_hidden: true })
|
|
135
|
+
})
|
|
136
|
+
|
|
137
|
+
it('preselects Hidden conversations when it is the active filter', () => {
|
|
138
|
+
const view = renderFilters({ show_hidden: true })
|
|
139
|
+
|
|
140
|
+
const selected = view.getByRole('button', { selected: true })
|
|
141
|
+
expect(within(selected).getByText('Hidden conversations')).toBeTruthy()
|
|
142
|
+
})
|
|
143
|
+
})
|
|
@@ -10,7 +10,9 @@ import {
|
|
|
10
10
|
useTheme,
|
|
11
11
|
} from '../../../hooks'
|
|
12
12
|
import { useFilterDropdownEnabled } from '../../../hooks/use_filter_dropdown_enabled'
|
|
13
|
-
import {
|
|
13
|
+
import { useHiddenConversationsCount } from '../../../hooks/use_hidden_conversations_count'
|
|
14
|
+
import { useHideConversationsEnabled } from '../../../hooks/use_hide_conversations_enabled'
|
|
15
|
+
import { faBoxArchive, faEyeSlash } from '../../../vendor/font_awesome_pro_solid_icons'
|
|
14
16
|
import { FilterContext, useFilterContext } from '../context/conversation_filter_context'
|
|
15
17
|
import { FilterTypes } from '../filter_types'
|
|
16
18
|
import { useGroupsToFilter, useTeamsToFilter } from '../hooks/filters'
|
|
@@ -69,6 +71,7 @@ export const ConversationFilters = () => {
|
|
|
69
71
|
group_source_app_name = '',
|
|
70
72
|
show_direct_messages,
|
|
71
73
|
show_archived,
|
|
74
|
+
show_hidden,
|
|
72
75
|
} = params
|
|
73
76
|
|
|
74
77
|
const filterDropdownEnabled = useFilterDropdownEnabled()
|
|
@@ -76,6 +79,9 @@ export const ConversationFilters = () => {
|
|
|
76
79
|
const hasDirectMessages = useHasDirectMessages()
|
|
77
80
|
const canFilterByDMs = directMessagesEligible && hasDirectMessages
|
|
78
81
|
const canFilterByArchived = useCanBrowseArchivedConversations()
|
|
82
|
+
const canFilterByHidden = useHideConversationsEnabled()
|
|
83
|
+
const hiddenCount = useHiddenConversationsCount()
|
|
84
|
+
const showOtherFilters = canFilterByArchived || canFilterByHidden
|
|
79
85
|
|
|
80
86
|
const activeFilter: FilterTypes = useMemo(() => {
|
|
81
87
|
if (chat_group_graph_id) {
|
|
@@ -88,10 +94,12 @@ export const ConversationFilters = () => {
|
|
|
88
94
|
return FilterTypes.DirectMessages
|
|
89
95
|
} else if (show_archived) {
|
|
90
96
|
return FilterTypes.Archived
|
|
97
|
+
} else if (show_hidden) {
|
|
98
|
+
return FilterTypes.Hidden
|
|
91
99
|
}
|
|
92
100
|
|
|
93
101
|
return FilterTypes.All
|
|
94
|
-
}, [chat_group_graph_id, group_source_app_name, show_direct_messages, show_archived])
|
|
102
|
+
}, [chat_group_graph_id, group_source_app_name, show_direct_messages, show_archived, show_hidden])
|
|
95
103
|
|
|
96
104
|
const { groups = [] } = useGroupsToFilter()
|
|
97
105
|
const { teams = [] } = useTeamsToFilter()
|
|
@@ -173,7 +181,7 @@ export const ConversationFilters = () => {
|
|
|
173
181
|
data: { routeName: 'TeamFilters' },
|
|
174
182
|
},
|
|
175
183
|
{
|
|
176
|
-
type:
|
|
184
|
+
type: showOtherFilters ? SectionTypes.header : SectionTypes.hidden,
|
|
177
185
|
data: { title: 'Other', style: styles.extraHeaderScalableSpace },
|
|
178
186
|
},
|
|
179
187
|
{
|
|
@@ -186,6 +194,17 @@ export const ConversationFilters = () => {
|
|
|
186
194
|
isActive: activeFilter === FilterTypes.Archived,
|
|
187
195
|
},
|
|
188
196
|
},
|
|
197
|
+
{
|
|
198
|
+
type: canFilterByHidden ? SectionTypes.other : SectionTypes.hidden,
|
|
199
|
+
data: {
|
|
200
|
+
filter: FilterTypes.Hidden,
|
|
201
|
+
description: 'Hidden for just you',
|
|
202
|
+
icon: faEyeSlash,
|
|
203
|
+
show_hidden: true,
|
|
204
|
+
count: hiddenCount,
|
|
205
|
+
isActive: activeFilter === FilterTypes.Hidden,
|
|
206
|
+
},
|
|
207
|
+
},
|
|
189
208
|
]
|
|
190
209
|
|
|
191
210
|
return (
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { IconDefinition } from '@fortawesome/fontawesome-svg-core'
|
|
2
2
|
import { PlatformPressable } from '@react-navigation/elements'
|
|
3
3
|
import { NavigationProp, useNavigation } from '@react-navigation/native'
|
|
4
|
-
import React, { PropsWithChildren, useContext } from 'react'
|
|
4
|
+
import React, { PropsWithChildren, ReactNode, useContext } from 'react'
|
|
5
5
|
import { StyleSheet, View, ViewStyle } from 'react-native'
|
|
6
6
|
import { Heading, Icon, IconTile, Image, Text, TextButton } from '../../../components'
|
|
7
7
|
import {
|
|
@@ -118,18 +118,38 @@ export const TeamRow = ({ team }: TeamRowProps) => {
|
|
|
118
118
|
|
|
119
119
|
export type OtherRowProps = {
|
|
120
120
|
show_archived?: boolean
|
|
121
|
+
show_hidden?: boolean
|
|
122
|
+
count?: number
|
|
121
123
|
isActive: boolean
|
|
122
124
|
filter: FilterTypes
|
|
123
125
|
description: string
|
|
124
126
|
icon: IconDefinition
|
|
125
127
|
}
|
|
126
128
|
|
|
127
|
-
export const OtherRow = ({
|
|
129
|
+
export const OtherRow = ({
|
|
130
|
+
show_archived,
|
|
131
|
+
show_hidden,
|
|
132
|
+
count,
|
|
133
|
+
isActive,
|
|
134
|
+
filter,
|
|
135
|
+
description,
|
|
136
|
+
icon,
|
|
137
|
+
}: OtherRowProps) => {
|
|
128
138
|
const styles = useRowStyles()
|
|
129
139
|
const { setAppFilter } = useContext(FilterContext)
|
|
130
140
|
|
|
131
141
|
return (
|
|
132
|
-
<PressableRow
|
|
142
|
+
<PressableRow
|
|
143
|
+
onPress={() => setAppFilter({ show_archived, show_hidden })}
|
|
144
|
+
isActive={isActive}
|
|
145
|
+
trailing={
|
|
146
|
+
count !== undefined && (
|
|
147
|
+
<Text variant="tertiary" testID="filter-row-count">
|
|
148
|
+
{count}
|
|
149
|
+
</Text>
|
|
150
|
+
)
|
|
151
|
+
}
|
|
152
|
+
>
|
|
133
153
|
<IconTile icon={icon} shape="square" size="lg" />
|
|
134
154
|
<View style={styles.rowTextContainer}>
|
|
135
155
|
<Heading variant="h3" style={styles.rowTitle}>
|
|
@@ -163,7 +183,13 @@ export const PressableRow = ({
|
|
|
163
183
|
isActive,
|
|
164
184
|
onPress,
|
|
165
185
|
style,
|
|
166
|
-
|
|
186
|
+
trailing,
|
|
187
|
+
}: PropsWithChildren<{
|
|
188
|
+
isActive: boolean
|
|
189
|
+
onPress: () => void
|
|
190
|
+
style?: ViewStyle
|
|
191
|
+
trailing?: ReactNode
|
|
192
|
+
}>) => {
|
|
167
193
|
const styles = useRowStyles({ isActive })
|
|
168
194
|
return (
|
|
169
195
|
<PlatformPressable
|
|
@@ -174,12 +200,15 @@ export const PressableRow = ({
|
|
|
174
200
|
>
|
|
175
201
|
<View style={styles.row}>
|
|
176
202
|
<View style={[styles.rowInner, style]}>{children}</View>
|
|
177
|
-
<
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
203
|
+
<View style={styles.rowTrailing}>
|
|
204
|
+
{trailing}
|
|
205
|
+
<Icon
|
|
206
|
+
name="general.check"
|
|
207
|
+
style={styles.rowIconRight}
|
|
208
|
+
accessibilityElementsHidden
|
|
209
|
+
maxFontSizeMultiplier={2.5}
|
|
210
|
+
/>
|
|
211
|
+
</View>
|
|
183
212
|
</View>
|
|
184
213
|
</PlatformPressable>
|
|
185
214
|
)
|
|
@@ -219,6 +248,11 @@ const useRowStyles = ({ isActive = false }: { isActive?: boolean } = {}) => {
|
|
|
219
248
|
rowTextContainer: {
|
|
220
249
|
flexShrink: 1,
|
|
221
250
|
},
|
|
251
|
+
rowTrailing: {
|
|
252
|
+
flexDirection: 'row',
|
|
253
|
+
alignItems: 'center',
|
|
254
|
+
gap: 12,
|
|
255
|
+
},
|
|
222
256
|
rowWithoutBorder: {
|
|
223
257
|
flexDirection: 'row',
|
|
224
258
|
alignItems: 'center',
|
|
@@ -23,6 +23,7 @@ export const FilterContext = createContext<{
|
|
|
23
23
|
group_source_app_name: undefined,
|
|
24
24
|
show_direct_messages: undefined,
|
|
25
25
|
show_archived: undefined,
|
|
26
|
+
show_hidden: undefined,
|
|
26
27
|
show_unread: undefined,
|
|
27
28
|
},
|
|
28
29
|
scrollOffset: 0,
|
|
@@ -60,6 +61,7 @@ export const FilterProvider = ({ children }: PropsWithChildren) => {
|
|
|
60
61
|
group_source_app_name: undefined,
|
|
61
62
|
show_direct_messages: undefined,
|
|
62
63
|
show_archived: undefined,
|
|
64
|
+
show_hidden: undefined,
|
|
63
65
|
show_unread: undefined,
|
|
64
66
|
})
|
|
65
67
|
)
|
|
@@ -70,6 +72,7 @@ export const FilterProvider = ({ children }: PropsWithChildren) => {
|
|
|
70
72
|
group_source_app_name: undefined,
|
|
71
73
|
show_direct_messages: undefined,
|
|
72
74
|
show_archived: undefined,
|
|
75
|
+
show_hidden: undefined,
|
|
73
76
|
show_unread: undefined,
|
|
74
77
|
})
|
|
75
78
|
},
|
|
@@ -79,6 +82,7 @@ export const FilterProvider = ({ children }: PropsWithChildren) => {
|
|
|
79
82
|
group_source_app_name: params.group_source_app_name,
|
|
80
83
|
show_direct_messages: params.show_direct_messages,
|
|
81
84
|
show_archived: params.show_archived,
|
|
85
|
+
show_hidden: params.show_hidden,
|
|
82
86
|
show_unread: undefined,
|
|
83
87
|
})
|
|
84
88
|
},
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
useGroupMembersForNewConversation,
|
|
13
13
|
} from '../../../hooks/groups/use_group_members_for_new_conversation'
|
|
14
14
|
import { useGroupsConversationCreate } from '../../../hooks/groups/use_groups_conversation_create'
|
|
15
|
+
import { useGroupsProxy } from '../../../hooks/groups/use_groups_proxy'
|
|
15
16
|
import {
|
|
16
17
|
type AvatarUpdatePayload,
|
|
17
18
|
patchConversationAvatar,
|
|
@@ -50,15 +51,16 @@ export const GroupsForm = ({ groupId, chat_group_graph_id, avatarSelection }: Gr
|
|
|
50
51
|
genderValue,
|
|
51
52
|
isFetching: genderFetching,
|
|
52
53
|
} = useMyGender()
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
54
|
+
const groupsProxied = useGroupsProxy()
|
|
55
|
+
const { data: group } = useSuspenseGet<GroupsGroupResource>(
|
|
56
|
+
groupsProxied
|
|
57
|
+
? {
|
|
58
|
+
url: `/me/groups_groups/${groupId}`,
|
|
59
|
+
data: { fields: { GroupsGroup: ['name', 'memberships_count'] } },
|
|
60
|
+
app: 'chat',
|
|
61
|
+
}
|
|
62
|
+
: { url: `/me/groups/${groupId}`, data: { fields: { Group: [] } }, app: 'groups' }
|
|
63
|
+
)
|
|
62
64
|
|
|
63
65
|
const activeGenderId = genderFilterEnabled ? genderId : null
|
|
64
66
|
const activeGenderValue = genderFilterEnabled ? genderValue : null
|
|
@@ -23,10 +23,10 @@ jest.mock('../../../contexts/conversations_context', () => ({
|
|
|
23
23
|
ConversationsContextProvider: ({ children }: { children: React.ReactNode }) => children,
|
|
24
24
|
}))
|
|
25
25
|
jest.mock('../../../components', () => ({
|
|
26
|
-
Conversations: ({ ListHeaderComponent }: { ListHeaderComponent: React.
|
|
27
|
-
|
|
28
|
-
),
|
|
26
|
+
Conversations: ({ ListHeaderComponent }: { ListHeaderComponent: React.ReactElement }) =>
|
|
27
|
+
ListHeaderComponent,
|
|
29
28
|
}))
|
|
29
|
+
jest.mock('../../../components/display/toast', () => ({ Toast: () => null }))
|
|
30
30
|
jest.mock('../components/list_header_component', () => {
|
|
31
31
|
const { Text } = require('react-native')
|
|
32
32
|
return { ListHeaderComponent: () => <Text>Default header</Text> }
|
|
@@ -19,6 +19,7 @@ const mockRouteParams: Record<string, unknown> = {}
|
|
|
19
19
|
const mockCanDisplayGroups = jest.fn()
|
|
20
20
|
const mockSearchEnabled = jest.fn()
|
|
21
21
|
const mockCanBrowseArchived = jest.fn()
|
|
22
|
+
const mockHideEnabled = jest.fn()
|
|
22
23
|
const mockGroupsByGraphId: Record<string, { name: string }> = {}
|
|
23
24
|
|
|
24
25
|
jest.mock('@react-navigation/native', () => ({
|
|
@@ -44,6 +45,9 @@ jest.mock('../../../../hooks/use_has_direct_messages', () => ({
|
|
|
44
45
|
jest.mock('../../../../hooks/use_can_browse_archived_conversations', () => ({
|
|
45
46
|
useCanBrowseArchivedConversations: () => mockCanBrowseArchived(),
|
|
46
47
|
}))
|
|
48
|
+
jest.mock('../../../../hooks/use_hide_conversations_enabled', () => ({
|
|
49
|
+
useHideConversationsEnabled: () => mockHideEnabled(),
|
|
50
|
+
}))
|
|
47
51
|
jest.mock('../../../../hooks/use_chat_permissions', () => ({
|
|
48
52
|
useCanCreateConversations: () => true,
|
|
49
53
|
}))
|
|
@@ -140,6 +144,7 @@ describe('FilterDropdownListHeaderComponent', () => {
|
|
|
140
144
|
mockSetParams.mockClear()
|
|
141
145
|
mockSearchEnabled.mockReturnValue(true)
|
|
142
146
|
mockCanBrowseArchived.mockReturnValue(false)
|
|
147
|
+
mockHideEnabled.mockReturnValue(false)
|
|
143
148
|
setCapabilities({ groups: true, teams: true })
|
|
144
149
|
setRouteParams({})
|
|
145
150
|
})
|
|
@@ -272,6 +277,43 @@ describe('FilterDropdownListHeaderComponent', () => {
|
|
|
272
277
|
expect(view.queryByText('Mark all read')).toBeNull()
|
|
273
278
|
})
|
|
274
279
|
|
|
280
|
+
it('offers More filters when hidden conversations are the only extra filter', () => {
|
|
281
|
+
setCapabilities({ groups: false, teams: false })
|
|
282
|
+
mockHideEnabled.mockReturnValue(true)
|
|
283
|
+
|
|
284
|
+
render(<FilterDropdownListHeaderComponent />)
|
|
285
|
+
|
|
286
|
+
expect(menuItemNames()).toEqual(['All', 'DMs', 'Unread', 'More filters'])
|
|
287
|
+
})
|
|
288
|
+
|
|
289
|
+
it('labels the hidden list and carries it into More filters', () => {
|
|
290
|
+
setRouteParams({ show_hidden: true })
|
|
291
|
+
|
|
292
|
+
render(<FilterDropdownListHeaderComponent />)
|
|
293
|
+
|
|
294
|
+
expect(screen.getByRole('button', { name: 'Hidden' })).toBeTruthy()
|
|
295
|
+
expect(screen.queryByText('Mark all read')).toBeNull()
|
|
296
|
+
|
|
297
|
+
fireEvent.press(screen.getByRole('menuitem', { name: 'More filters' }))
|
|
298
|
+
|
|
299
|
+
expect(mockNavigate).toHaveBeenCalledWith(
|
|
300
|
+
'ConversationFilters',
|
|
301
|
+
expect.objectContaining({ show_hidden: true })
|
|
302
|
+
)
|
|
303
|
+
})
|
|
304
|
+
|
|
305
|
+
it('leaves the hidden list when another filter is picked', () => {
|
|
306
|
+
setRouteParams({ show_hidden: true })
|
|
307
|
+
|
|
308
|
+
render(<FilterDropdownListHeaderComponent />)
|
|
309
|
+
|
|
310
|
+
fireEvent.press(screen.getByRole('menuitem', { name: 'Unread' }))
|
|
311
|
+
|
|
312
|
+
expect(mockSetParams).toHaveBeenCalledWith(
|
|
313
|
+
expect.objectContaining({ show_unread: true, show_hidden: undefined })
|
|
314
|
+
)
|
|
315
|
+
})
|
|
316
|
+
|
|
275
317
|
it('leaves the archived list when another filter is picked', () => {
|
|
276
318
|
setRouteParams({ show_archived: true })
|
|
277
319
|
|