diff --git a/client/src/containers/ChannelSelect/index.js b/client/src/containers/ChannelSelect/index.js index 9efce26d..23d731ad 100644 --- a/client/src/containers/ChannelSelect/index.js +++ b/client/src/containers/ChannelSelect/index.js @@ -1,13 +1,18 @@ import {connect} from 'react-redux'; import {setPublishInChannel, updateSelectedChannel, updateError} from '../../actions/publish'; +// import isApprovedChannel from '../../../../utils/isApprovedChannel'; import View from './view'; -const mapStateToProps = ({ channel, publish }) => { +const mapStateToProps = ({ publish, site, channel: { loggedInChannel: { name, shortId, longId } } }) => { return { - loggedInChannelName: channel.loggedInChannel.name, + // isApprovedChannel : isApprovedChannel({ longId }, site.approvedChannels), + publishOnlyApproved: site.publishOnlyApproved, + // closedRegistration : site.closedRegistration, + loggedInChannelName: name, publishInChannel : publish.publishInChannel, selectedChannel : publish.selectedChannel, channelError : publish.error.channel, + longId, }; }; diff --git a/client/src/containers/ChannelSelect/view.jsx b/client/src/containers/ChannelSelect/view.jsx index 4a4dc5fe..d04007d5 100644 --- a/client/src/containers/ChannelSelect/view.jsx +++ b/client/src/containers/ChannelSelect/view.jsx @@ -16,9 +16,12 @@ class ChannelSelect extends React.Component { this.handleSelection = this.handleSelection.bind(this); } componentWillMount () { - const { loggedInChannelName } = this.props; + const { loggedInChannelName, onChannelSelect, publishOnlyApproved, onPublishInChannelChange } = this.props; if (loggedInChannelName) { - this.props.onChannelSelect(loggedInChannelName); + onChannelSelect(loggedInChannelName); + } + if (publishOnlyApproved) { + onPublishInChannelChange(true); } } toggleAnonymousPublish (event) { @@ -34,7 +37,17 @@ class ChannelSelect extends React.Component { this.props.onChannelSelect(selectedOption); } render () { - const { publishInChannel, channelError, selectedChannel, loggedInChannelName } = this.props; + const { publishInChannel, channelError, selectedChannel, loggedInChannelName, publishOnlyApproved } = this.props; + if (publishOnlyApproved) { + return ( + <div> + <RowLabeled + label={<Label value={'Channel:'} />} + content={<span>{loggedInChannelName}</span>} + /> + </div> + ); + } return ( <div> <RowLabeled