diff --git a/webapp/channels/src/components/at_mention/__snapshots__/at_mention.test.tsx.snap b/webapp/channels/src/components/at_mention/__snapshots__/at_mention.test.tsx.snap index a8947094bf..0cf14140b8 100644 --- a/webapp/channels/src/components/at_mention/__snapshots__/at_mention.test.tsx.snap +++ b/webapp/channels/src/components/at_mention/__snapshots__/at_mention.test.tsx.snap @@ -149,7 +149,7 @@ exports[`components/AtMention should match snapshot when mentioning current user rootClose={true} show={false} > - - - - - - - ; children?: React.ReactNode; channelId?: string; - hasMention?: boolean; disableHighlight?: boolean; disableGroupHighlight?: boolean; } @@ -122,7 +121,6 @@ export const AtMention = (props: Props) => { className='user-profile-popover' userId={user.id} src={Client4.getProfilePictureUrl(user.id, user.last_picture_update)} - hasMention={props.hasMention} hide={hideOverlay} channelId={props.channelId} /> @@ -187,7 +185,6 @@ export const AtMention = (props: Props) => { userId={groupUser.id} src={Client4.getProfilePictureUrl(groupUser.id, groupUser.last_picture_update)} channelId={props.channelId} - hasMention={props.hasMention} hide={hideGroupUserOverlay} returnFocus={returnFocus} /> diff --git a/webapp/channels/src/components/custom_status/custom_status_emoji.tsx b/webapp/channels/src/components/custom_status/custom_status_emoji.tsx index 6eb61d0810..082e1e39ff 100644 --- a/webapp/channels/src/components/custom_status/custom_status_emoji.tsx +++ b/webapp/channels/src/components/custom_status/custom_status_emoji.tsx @@ -48,8 +48,7 @@ function CustomStatusEmoji({ const customStatusExpired = useSelector((state: GlobalState) => isCustomStatusExpired(state, customStatus)); const customStatusEnabled = useSelector(isCustomStatusEnabled); - const isCustomStatusSet = Boolean(customStatusEnabled && customStatus?.emoji && !customStatusExpired); - if (!isCustomStatusSet) { + if (!customStatusEnabled || !customStatus?.emoji || customStatusExpired) { return null; } diff --git a/webapp/channels/src/components/drafts/panel/__snapshots__/panel_body.test.tsx.snap b/webapp/channels/src/components/drafts/panel/__snapshots__/panel_body.test.tsx.snap index 2824843da8..59e8869f0f 100644 --- a/webapp/channels/src/components/drafts/panel/__snapshots__/panel_body.test.tsx.snap +++ b/webapp/channels/src/components/drafts/panel/__snapshots__/panel_body.test.tsx.snap @@ -44,10 +44,9 @@ exports[`components/drafts/panel/panel_body should have called handleFormattedTe { + const intl = useIntl(); const {post, compactDisplay, isMobileView, isConsecutivePost, enablePostUsernameOverride, isBot, isSystemMessage, colorizeUsernames} = props; const isFromAutoResponder = fromAutoResponder(post); const colorize = compactDisplay && colorizeUsernames; @@ -55,7 +56,6 @@ const PostUserProfile = (props: Props): JSX.Element | null => { userId={post.user_id} channelId={post.channel_id} isRHS={isRHS} - hasMention={true} colorize={colorize} /> ); @@ -67,7 +67,6 @@ const PostUserProfile = (props: Props): JSX.Element | null => { userId={post.user_id} channelId={post.channel_id} isRHS={isRHS} - hasMention={true} colorize={colorize} /> ); @@ -77,7 +76,6 @@ const PostUserProfile = (props: Props): JSX.Element | null => { userId={post.user_id} channelId={post.channel_id} isRHS={isRHS} - hasMention={true} colorize={colorize} /> ); @@ -108,7 +106,6 @@ const PostUserProfile = (props: Props): JSX.Element | null => { channelId={post.channel_id} hideStatus={true} isRHS={isRHS} - hasMention={true} colorize={colorize} /> @@ -135,12 +132,10 @@ const PostUserProfile = (props: Props): JSX.Element | null => { } else if (isSystemMessage) { userProfile = ( - } + overwriteName={intl.formatMessage({ + id: 'post_info.system', + defaultMessage: 'System', + })} userId={post.user_id} disablePopover={true} channelId={post.channel_id} diff --git a/webapp/channels/src/components/post_edit_history/edited_post_item/__snapshots__/edited_post_item.test.tsx.snap b/webapp/channels/src/components/post_edit_history/edited_post_item/__snapshots__/edited_post_item.test.tsx.snap index 7cb1404380..21e0e44ac8 100644 --- a/webapp/channels/src/components/post_edit_history/edited_post_item/__snapshots__/edited_post_item.test.tsx.snap +++ b/webapp/channels/src/components/post_edit_history/edited_post_item/__snapshots__/edited_post_item.test.tsx.snap @@ -230,7 +230,6 @@ exports[`components/post_edit_history/edited_post_item should match snapshot whe > diff --git a/webapp/channels/src/components/post_edit_history/edited_post_item/edited_post_item.tsx b/webapp/channels/src/components/post_edit_history/edited_post_item/edited_post_item.tsx index 9b7190a51a..046713ee53 100644 --- a/webapp/channels/src/components/post_edit_history/edited_post_item/edited_post_item.tsx +++ b/webapp/channels/src/components/post_edit_history/edited_post_item/edited_post_item.tsx @@ -145,7 +145,6 @@ const EditedPostItem = ({post, isCurrent = false, postCurrentVersion, theme, act
diff --git a/webapp/channels/src/components/post_profile_picture/post_profile_picture.test.tsx b/webapp/channels/src/components/post_profile_picture/post_profile_picture.test.tsx index 40a366516a..2c9d6c9db5 100644 --- a/webapp/channels/src/components/post_profile_picture/post_profile_picture.test.tsx +++ b/webapp/channels/src/components/post_profile_picture/post_profile_picture.test.tsx @@ -24,7 +24,6 @@ describe('components/PostProfilePicture', () => { enablePostIconOverride: true, compactDisplay: true, hasImageProxy: true, - isBusy: true, post, user, isBot: Boolean(user.is_bot), diff --git a/webapp/channels/src/components/post_profile_picture/post_profile_picture.tsx b/webapp/channels/src/components/post_profile_picture/post_profile_picture.tsx index 6bf0e4172f..614b8bd4f1 100644 --- a/webapp/channels/src/components/post_profile_picture/post_profile_picture.tsx +++ b/webapp/channels/src/components/post_profile_picture/post_profile_picture.tsx @@ -18,7 +18,6 @@ type Props = { compactDisplay?: boolean; enablePostIconOverride: boolean; hasImageProxy: boolean; - isBusy?: boolean; post: Post; status?: string; user: UserProfile; @@ -81,7 +80,6 @@ export default class PostProfilePicture extends React.PureComponent { const { availabilityStatusOnPosts, compactDisplay, - isBusy, post, user, isBot, @@ -107,7 +105,6 @@ export default class PostProfilePicture extends React.PureComponent { return (

diff --git a/webapp/channels/src/components/post_view/commented_on/__snapshots__/commented_on.test.tsx.snap b/webapp/channels/src/components/post_view/commented_on/__snapshots__/commented_on.test.tsx.snap index 1c1cc92713..65f4636749 100644 --- a/webapp/channels/src/components/post_view/commented_on/__snapshots__/commented_on.test.tsx.snap +++ b/webapp/channels/src/components/post_view/commented_on/__snapshots__/commented_on.test.tsx.snap @@ -16,7 +16,6 @@ exports[`components/post_view/CommentedOn should match snapshot 1`] = ` > , @@ -49,7 +48,6 @@ exports[`components/post_view/CommentedOn should match snapshot 2`] = ` > , @@ -82,7 +80,6 @@ exports[`components/post_view/CommentedOn should match snapshot 3`] = ` > , @@ -117,7 +114,6 @@ exports[`components/post_view/CommentedOn should match snapshots for post with p > , @@ -150,7 +146,6 @@ exports[`components/post_view/CommentedOn should match snapshots for post with p > , @@ -183,7 +178,6 @@ exports[`components/post_view/CommentedOn should match snapshots for post with p > , @@ -216,7 +210,6 @@ exports[`components/post_view/CommentedOn should match snapshots for post with p > , diff --git a/webapp/channels/src/components/post_view/commented_on/commented_on.tsx b/webapp/channels/src/components/post_view/commented_on/commented_on.tsx index 4c6cbd4935..04f95d11e9 100644 --- a/webapp/channels/src/components/post_view/commented_on/commented_on.tsx +++ b/webapp/channels/src/components/post_view/commented_on/commented_on.tsx @@ -44,7 +44,6 @@ function CommentedOn({post, parentPostUser, onCommentClick}: Props) { const parentUserProfile = ( ); diff --git a/webapp/channels/src/components/post_view/post_message_preview/__snapshots__/post_message_preview.test.tsx.snap b/webapp/channels/src/components/post_view/post_message_preview/__snapshots__/post_message_preview.test.tsx.snap index c1ba45b470..07e9833352 100644 --- a/webapp/channels/src/components/post_view/post_message_preview/__snapshots__/post_message_preview.test.tsx.snap +++ b/webapp/channels/src/components/post_view/post_message_preview/__snapshots__/post_message_preview.test.tsx.snap @@ -34,7 +34,6 @@ exports[`PostMessagePreview direct and group messages should render preview for > @@ -121,7 +120,6 @@ exports[`PostMessagePreview direct and group messages should render preview for > @@ -208,7 +206,6 @@ exports[`PostMessagePreview nested previews should render file preview 1`] = ` > @@ -315,7 +312,6 @@ exports[`PostMessagePreview nested previews should render opengraph preview 1`] > @@ -430,7 +426,6 @@ exports[`PostMessagePreview should not render bot icon 1`] = ` > @@ -522,7 +517,6 @@ exports[`PostMessagePreview should render bot icon 1`] = ` > @@ -614,7 +608,6 @@ exports[`PostMessagePreview should render correctly 1`] = ` > @@ -703,7 +696,6 @@ exports[`PostMessagePreview show render without preview when preview posts becom > diff --git a/webapp/channels/src/components/post_view/post_message_preview/post_message_preview.tsx b/webapp/channels/src/components/post_view/post_message_preview/post_message_preview.tsx index 6dc2d286f6..97264b369f 100644 --- a/webapp/channels/src/components/post_view/post_message_preview/post_message_preview.tsx +++ b/webapp/channels/src/components/post_view/post_message_preview/post_message_preview.tsx @@ -174,7 +174,6 @@ const PostMessagePreview = (props: Props) => {

diff --git a/webapp/channels/src/components/profile_picture/__snapshots__/profile_picture.test.tsx.snap b/webapp/channels/src/components/profile_picture/__snapshots__/profile_picture.test.tsx.snap index 40cc0ced20..6b4aead388 100644 --- a/webapp/channels/src/components/profile_picture/__snapshots__/profile_picture.test.tsx.snap +++ b/webapp/channels/src/components/profile_picture/__snapshots__/profile_picture.test.tsx.snap @@ -44,11 +44,9 @@ exports[`components/ProfilePicture should match snapshot, profile and src, defau diff --git a/webapp/channels/src/components/profile_picture/profile_picture.test.tsx b/webapp/channels/src/components/profile_picture/profile_picture.test.tsx index 677190de52..7e8abbaf72 100644 --- a/webapp/channels/src/components/profile_picture/profile_picture.test.tsx +++ b/webapp/channels/src/components/profile_picture/profile_picture.test.tsx @@ -13,7 +13,6 @@ describe('components/ProfilePicture', () => { const baseProps: Props = { src: 'http://example.com/image.png', status: 'away', - isBusy: true, }; test('should match snapshot, no user specified, default props', () => { @@ -43,7 +42,6 @@ describe('components/ProfilePicture', () => { const props: Props = { ...baseProps, size: 'xl', - hasMention: true, }; const wrapper = shallow( , @@ -69,7 +67,6 @@ describe('components/ProfilePicture', () => { ...baseProps, username: 'username', size: 'xs', - hasMention: true, }; const wrapper = shallow( , diff --git a/webapp/channels/src/components/profile_picture/profile_picture.tsx b/webapp/channels/src/components/profile_picture/profile_picture.tsx index 2ce0a7d4dc..373c2975fc 100644 --- a/webapp/channels/src/components/profile_picture/profile_picture.tsx +++ b/webapp/channels/src/components/profile_picture/profile_picture.tsx @@ -20,8 +20,6 @@ interface MMOverlayTrigger extends BaseOverlayTrigger { } type Props = { - hasMention?: boolean; - isBusy?: boolean; isEmoji?: boolean; profileSrc?: string; size?: ComponentProps['size']; @@ -80,10 +78,8 @@ export default class ProfilePicture extends React.PureComponent { className='user-profile-popover' userId={this.props.userId} src={profileSrc} - isBusy={this.props.isBusy} hide={this.hideProfilePopover} channelId={this.props.channelId} - hasMention={this.props.hasMention} overwriteIcon={this.props.overwriteIcon} overwriteName={this.props.overwriteName} fromWebhook={this.props.fromWebhook} diff --git a/webapp/channels/src/components/profile_popover/__snapshots__/profile_popover.test.tsx.snap b/webapp/channels/src/components/profile_popover/__snapshots__/profile_popover.test.tsx.snap deleted file mode 100644 index 1fa1c25a00..0000000000 --- a/webapp/channels/src/components/profile_popover/__snapshots__/profile_popover.test.tsx.snap +++ /dev/null @@ -1,4482 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`components/ProfilePopover should disable start call button when user is in another call 1`] = ` - - -
-
- - - -
-
-
- - -
-
- , - } - } - /> -
-
- @some_username -
-
- -
- -
- - Add to a Channel - - } - placement="top" - trigger={ - Array [ - "hover", - "focus", - ] - } - > -
- - - -
-
- - some_username is in another call - - } - placement="top" - trigger={ - Array [ - "hover", - "focus", - ] - } - > - - -
-
- -
-
- -
-`; - -exports[`components/ProfilePopover should hide add-to-channel option if not on team 1`] = ` - - -
-
- - - -
-
-
- - -
-
- , - } - } - /> -
-
- @some_username -
-
- -
- -
- - Start Call - - } - placement="top" - trigger={ - Array [ - "hover", - "focus", - ] - } - > - - - } - userId="0" - /> -
-
- -
-
- -
-`; - -exports[`components/ProfilePopover should match snapshot 1`] = ` - - -
-
- - - -
-
-
- - -
-
- , - } - } - /> -
-
- @some_username -
-
- -
- -
- - Add to a Channel - - } - placement="top" - trigger={ - Array [ - "hover", - "focus", - ] - } - > -
- - - -
-
- - Start Call - - } - placement="top" - trigger={ - Array [ - "hover", - "focus", - ] - } - > - - - } - userId="0" - /> -
-
- -
-
- -
-`; - -exports[`components/ProfilePopover should match snapshot for shared user 1`] = ` - - -
-
- - - -
-
-
- - -
-
- , - } - } - /> -
-
- - shared - - -
-
- @shared_user -
-
- -
- -
- - Add to a Channel - - } - placement="top" - trigger={ - Array [ - "hover", - "focus", - ] - } - > -
- - - -
-
- - Start Call - - } - placement="top" - trigger={ - Array [ - "hover", - "focus", - ] - } - > - - - } - userId="0" - /> -
-
- -
-
- -
-`; - -exports[`components/ProfilePopover should match snapshot when calls are disabled 1`] = ` - - -
-
- - - -
-
-
- - -
-
- , - } - } - /> -
-
- @some_username -
-
- -
- -
- - Add to a Channel - - } - placement="top" - trigger={ - Array [ - "hover", - "focus", - ] - } - > -
- - - -
-
-
-
- -
-
- -
-`; - -exports[`components/ProfilePopover should match snapshot with custom status 1`] = ` - - -
-
- - - -
-
-
- - -
-
- , - } - } - /> -
-
- @some_username -
-
- -
- - - - -
- - -
-
-
- -
- - Add to a Channel - - } - placement="top" - trigger={ - Array [ - "hover", - "focus", - ] - } - > -
- - - -
-
- - Start Call - - } - placement="top" - trigger={ - Array [ - "hover", - "focus", - ] - } - > - - - } - userId="0" - /> -
-
- -
-
- -
-`; - -exports[`components/ProfilePopover should match snapshot with custom status expired 1`] = ` - - -
-
- - - -
-
-
- - -
-
- , - } - } - /> -
-
- @some_username -
-
- -
- -
- - Add to a Channel - - } - placement="top" - trigger={ - Array [ - "hover", - "focus", - ] - } - > -
- - - -
-
- - Start Call - - } - placement="top" - trigger={ - Array [ - "hover", - "focus", - ] - } - > - - - } - userId="0" - /> -
-
- -
-
- -
-`; - -exports[`components/ProfilePopover should match snapshot with custom status not set but can set 1`] = ` - - -
-
- - - -
-
-
- - -
-
- , - } - } - /> -
-
- @some_username -
-
- -
- - - - -
-
- - - - - } - placement="top" - trigger={ - Array [ - "hover", - "focus", - ] - } - > - - -
- -
-
- -
-`; - -exports[`components/ProfilePopover should match snapshot with last active display 1`] = ` - - -
-
- - - -
-
-
- - -
-
- , - } - } - /> -
-
- @some_username -
-
- -
- -
- - Add to a Channel - - } - placement="top" - trigger={ - Array [ - "hover", - "focus", - ] - } - > -
- - - -
-
- - Start Call - - } - placement="top" - trigger={ - Array [ - "hover", - "focus", - ] - } - > - - - } - userId="0" - /> -
-
- -
-
- -
-`; - -exports[`components/ProfilePopover should match snapshot with no last active display because it is disabled 1`] = ` - - -
-
- - - -
-
-
- - -
-
- @some_username -
-
- -
- -
- - Add to a Channel - - } - placement="top" - trigger={ - Array [ - "hover", - "focus", - ] - } - > -
- - - -
-
- - Start Call - - } - placement="top" - trigger={ - Array [ - "hover", - "focus", - ] - } - > - - - } - userId="0" - /> -
-
- -
-
- -
-`; - -exports[`components/ProfilePopover should show the start call button when isCallsDefaultEnabledOnAllChannels, isCallsCanBeDisabledOnSpecificChannels is false and callsChannelState.enabled is true 1`] = ` - - - - - - ); }; + +export default ProfileTimezone; diff --git a/webapp/channels/src/components/shared_user_indicator.tsx b/webapp/channels/src/components/shared_user_indicator.tsx index c364e38135..4b93944fe6 100644 --- a/webapp/channels/src/components/shared_user_indicator.tsx +++ b/webapp/channels/src/components/shared_user_indicator.tsx @@ -2,7 +2,7 @@ // See LICENSE.txt for license information. import React from 'react'; -import {FormattedMessage} from 'react-intl'; +import {FormattedMessage, useIntl} from 'react-intl'; import OverlayTrigger from 'components/overlay_trigger'; import Tooltip from 'components/tooltip'; @@ -15,7 +15,14 @@ type Props = { }; const SharedUserIndicator: React.FC = (props: Props): JSX.Element => { - const sharedIcon = (); + const intl = useIntl(); + + const sharedIcon = ( + + ); if (!props.withTooltip) { return sharedIcon; diff --git a/webapp/channels/src/components/threading/channel_threads/thread_footer/__snapshots__/thread_footer.test.tsx.snap b/webapp/channels/src/components/threading/channel_threads/thread_footer/__snapshots__/thread_footer.test.tsx.snap index 3f75708eb7..fe822b13c7 100644 --- a/webapp/channels/src/components/threading/channel_threads/thread_footer/__snapshots__/thread_footer.test.tsx.snap +++ b/webapp/channels/src/components/threading/channel_threads/thread_footer/__snapshots__/thread_footer.test.tsx.snap @@ -86,7 +86,7 @@ exports[`components/threading/channel_threads/thread_footer should report total defaultOverlayShown={false} disabled={false} overlay={ - { diff --git a/webapp/channels/src/components/user_profile/__snapshots__/user_profile.test.tsx.snap b/webapp/channels/src/components/user_profile/__snapshots__/user_profile.test.tsx.snap index 6c737d8f40..12f9b3f2cc 100644 --- a/webapp/channels/src/components/user_profile/__snapshots__/user_profile.test.tsx.snap +++ b/webapp/channels/src/components/user_profile/__snapshots__/user_profile.test.tsx.snap @@ -5,12 +5,10 @@ exports[`components/UserProfile should match snapshot 1`] = ` { static defaultProps: Partial = { disablePopover: false, displayUsername: false, - hasMention: false, hideStatus: false, isRHS: false, overwriteName: '', @@ -66,11 +63,9 @@ export default class UserProfile extends PureComponent { disablePopover, displayName, displayUsername, - isBusy, isMobileView, isRHS, isShared, - hasMention, hideStatus, overwriteName, overwriteIcon, @@ -142,10 +137,8 @@ export default class UserProfile extends PureComponent { userId={userId} channelId={channelId} src={profileImg} - isBusy={isBusy} hide={this.hideProfilePopover} hideStatus={hideStatus} - hasMention={hasMention} overwriteName={overwriteName} overwriteIcon={overwriteIcon} /> diff --git a/webapp/channels/src/components/widgets/users/avatars/__snapshots__/avatars.test.tsx.snap b/webapp/channels/src/components/widgets/users/avatars/__snapshots__/avatars.test.tsx.snap index 58395a11b5..6e10b239b7 100644 --- a/webapp/channels/src/components/widgets/users/avatars/__snapshots__/avatars.test.tsx.snap +++ b/webapp/channels/src/components/widgets/users/avatars/__snapshots__/avatars.test.tsx.snap @@ -40,7 +40,7 @@ exports[`components/widgets/users/Avatars should fetch missing users 1`] = ` defaultOverlayShown={false} disabled={false} overlay={ - UserCustomStatus { +export function makeGetCustomStatus(): (state: GlobalState, userID?: string) => UserCustomStatus | undefined { return createSelector( 'makeGetCustomStatus', (state: GlobalState, userID?: string) => (userID ? getUser(state, userID) : getCurrentUser(state)), diff --git a/webapp/channels/src/store/index.js b/webapp/channels/src/store/index.js index ef2805aad2..a223adc0ae 100644 --- a/webapp/channels/src/store/index.js +++ b/webapp/channels/src/store/index.js @@ -22,9 +22,10 @@ window.Observable = Observable; const localForage = extendPrototype(baseLocalForage); -export default function configureStore(preloadedState) { +export default function configureStore(preloadedState, additionalReducers) { + const reducers = additionalReducers ? {...appReducers, ...additionalReducers} : appReducers; const store = configureServiceStore({ - appReducers, + appReducers: reducers, getAppReducers, preloadedState, }); diff --git a/webapp/channels/src/tests/react_testing_utils.tsx b/webapp/channels/src/tests/react_testing_utils.tsx index e986179800..938b8f328d 100644 --- a/webapp/channels/src/tests/react_testing_utils.tsx +++ b/webapp/channels/src/tests/react_testing_utils.tsx @@ -8,6 +8,7 @@ import React from 'react'; import {IntlProvider} from 'react-intl'; import {Provider} from 'react-redux'; import {Router} from 'react-router-dom'; +import type {Reducer} from 'redux'; import type {DeepPartial} from '@mattermost/types/utilities'; @@ -26,6 +27,7 @@ export type FullContextOptions = { intlMessages?: Record; locale?: string; useMockedStore?: boolean; + pluginReducers?: string[]; } export const renderWithContext = ( @@ -39,7 +41,7 @@ export const renderWithContext = ( useMockedStore: partialOptions?.useMockedStore ?? false, }; - const testStore = configureOrMockStore(initialState, options.useMockedStore); + const testStore = configureOrMockStore(initialState, options.useMockedStore, partialOptions?.pluginReducers); // Store these in an object so that they can be maintained through rerenders const renderState = { @@ -82,7 +84,7 @@ export const renderWithContext = ( * Rerenders the component after replacing the entire store state with the provided one. */ replaceStoreState: (newInitialState: DeepPartial) => { - renderState.store = configureOrMockStore(newInitialState, renderState.options.useMockedStore); + renderState.store = configureOrMockStore(newInitialState, renderState.options.useMockedStore, partialOptions?.pluginReducers); results.rerender(renderState.component); }, @@ -92,15 +94,25 @@ export const renderWithContext = ( */ updateStoreState: (stateDiff: DeepPartial) => { const newInitialState = mergeObjects(renderState.store.getState(), stateDiff); - renderState.store = configureOrMockStore(newInitialState, renderState.options.useMockedStore); + renderState.store = configureOrMockStore(newInitialState, renderState.options.useMockedStore, partialOptions?.pluginReducers); results.rerender(renderState.component); }, }; }; -function configureOrMockStore(initialState: DeepPartial, useMockedStore: boolean) { - let testStore = configureStore(initialState); +function configureOrMockStore(initialState: DeepPartial, useMockedStore: boolean, extraReducersKeys?: string[]) { + let testReducers; + if (extraReducersKeys) { + const newReducers: Record = {}; + extraReducersKeys.forEach((v) => { + newReducers[v] = (state = null) => state; + }); + + testReducers = newReducers; + } + + let testStore = configureStore(initialState, testReducers); if (useMockedStore) { testStore = mockStore(testStore.getState()); } diff --git a/webapp/channels/src/utils/__snapshots__/message_html_to_component.test.tsx.snap b/webapp/channels/src/utils/__snapshots__/message_html_to_component.test.tsx.snap index 1496d526c1..4bbf9a49e4 100644 --- a/webapp/channels/src/utils/__snapshots__/message_html_to_component.test.tsx.snap +++ b/webapp/channels/src/utils/__snapshots__/message_html_to_component.test.tsx.snap @@ -11,7 +11,6 @@ exports[`messageHtmlToComponent At mention 1`] = ` @joram @@ -29,7 +28,6 @@ exports[`messageHtmlToComponent At mention 2`] = ` @joram @@ -46,7 +44,6 @@ exports[`messageHtmlToComponent At mention with group highlight disabled 1`] = ` @developers @@ -63,7 +60,6 @@ exports[`messageHtmlToComponent At mention with group highlight disabled 2`] = ` @developers diff --git a/webapp/channels/src/utils/message_html_to_component.tsx b/webapp/channels/src/utils/message_html_to_component.tsx index c336881480..bc3b557661 100644 --- a/webapp/channels/src/utils/message_html_to_component.tsx +++ b/webapp/channels/src/utils/message_html_to_component.tsx @@ -129,7 +129,6 @@ export function messageHtmlToComponent(html: string, options: Options = {}) { const callAtMention = (