diff --git a/webapp/channels/src/components/channel_select/channel_select.tsx b/webapp/channels/src/components/channel_select/channel_select.tsx index ba79b1c6f7..740f411200 100644 --- a/webapp/channels/src/components/channel_select/channel_select.tsx +++ b/webapp/channels/src/components/channel_select/channel_select.tsx @@ -1,13 +1,13 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -import React from 'react'; +import React, {memo} from 'react'; import type {ChangeEventHandler} from 'react'; +import {useIntl} from 'react-intl'; import type {Channel} from '@mattermost/types/channels'; import Constants from 'utils/constants'; -import * as Utils from 'utils/utils'; type Props = { channels: Channel[]; @@ -18,58 +18,70 @@ type Props = { selectDm: boolean; }; -export default class ChannelSelect extends React.PureComponent { - render(): JSX.Element { - const options = [ - , - ]; +const ChannelSelect = ({ + channels, + selectOpen, + selectPrivate, + selectDm, + value, + onChange, +}: Props) => { + const intl = useIntl(); - this.props.channels.forEach((channel: Channel) => { - const channelName = channel.display_name || channel.name; - if (channel.type === Constants.OPEN_CHANNEL && this.props.selectOpen) { - options.push( - , - ); - } else if (channel.type === Constants.PRIVATE_CHANNEL && this.props.selectPrivate) { - options.push( - , - ); - } else if (channel.type === Constants.DM_CHANNEL && this.props.selectDm) { - options.push( - , - ); - } - }); + const options = [ + , + ]; - return ( - - ); - } -} + channels.forEach((channel: Channel) => { + const channelName = channel.display_name || channel.name; + if (channel.type === Constants.OPEN_CHANNEL && selectOpen) { + options.push( + , + ); + } else if (channel.type === Constants.PRIVATE_CHANNEL && selectPrivate) { + options.push( + , + ); + } else if (channel.type === Constants.DM_CHANNEL && selectDm) { + options.push( + , + ); + } + }); + + return ( + + ); +}; + +export default memo(ChannelSelect); diff --git a/webapp/channels/src/components/integrations/__snapshots__/abstract_incoming_hook.test.tsx.snap b/webapp/channels/src/components/integrations/__snapshots__/abstract_incoming_hook.test.tsx.snap index 9a1bf54117..5d0515d4c4 100644 --- a/webapp/channels/src/components/integrations/__snapshots__/abstract_incoming_hook.test.tsx.snap +++ b/webapp/channels/src/components/integrations/__snapshots__/abstract_incoming_hook.test.tsx.snap @@ -106,7 +106,7 @@ exports[`components/integrations/AbstractIncomingWebhook should call action func
- - - - - - -