From 2233952cebd368629eed4e5aebe0741e4616084e Mon Sep 17 00:00:00 2001 From: Fernando Valverde Date: Tue, 30 Jun 2020 12:03:41 -0600 Subject: [PATCH] [deploy] Discoverable channel will open CTA to request join if not available (#8999) --- app/javascript/chat/channels.jsx | 3 + app/javascript/chat/chat.jsx | 3 + .../chat/components/channelButton.jsx | 126 ++++++++++-------- 3 files changed, 77 insertions(+), 55 deletions(-) diff --git a/app/javascript/chat/channels.jsx b/app/javascript/chat/channels.jsx index 310366c59..79ea0a6a3 100644 --- a/app/javascript/chat/channels.jsx +++ b/app/javascript/chat/channels.jsx @@ -28,6 +28,9 @@ const Channels = ({ channel={channel} discoverableChannel triggerActiveContent={triggerActiveContent} + isActiveChannel={ + parseInt(activeChannelId, 10) === channel.chat_channel_id + } /> ); }, diff --git a/app/javascript/chat/chat.jsx b/app/javascript/chat/chat.jsx index d5deda3dd..1600a8d2c 100644 --- a/app/javascript/chat/chat.jsx +++ b/app/javascript/chat/chat.jsx @@ -146,6 +146,9 @@ export default class Chat extends Component { searchType: '', paginationNumber: channelPaginationNum, }; + if (activeChannelId !== null) { + searchParams.searchType = 'discoverable'; + } getChannels(searchParams, filters, this.loadChannels); getUnopenedChannelIds(this.markUnopenedChannelIds); } diff --git a/app/javascript/chat/components/channelButton.jsx b/app/javascript/chat/components/channelButton.jsx index 42422b0b2..24e8aa55b 100644 --- a/app/javascript/chat/components/channelButton.jsx +++ b/app/javascript/chat/components/channelButton.jsx @@ -1,81 +1,97 @@ -import { h } from 'preact'; +import { h, Component, createRef } from 'preact'; import PropTypes from 'prop-types'; -const ChannelButton = ({ - channel, - handleSwitchChannel, - otherClassname, - newMessagesIndicator, - isUnopened, - discoverableChannel, - triggerActiveContent, -}) => { - return ( - - ); -}; + + ); + } +} ChannelButton.propTypes = { channel: PropTypes.shape({