MM-34619 post draft to use the channelId prop when assigned (#5488)

This commit is contained in:
Elias Nahum 2021-06-30 19:04:47 -04:00 committed by GitHub
parent bdbdc0b7ba
commit 05ead9f734
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -5,7 +5,7 @@ import {connect} from 'react-redux';
import {isMinimumServerVersion} from '@mm-redux/utils/helpers';
import {General, Permissions} from '@mm-redux/constants';
import {getCurrentChannel, getChannel, isCurrentChannelReadOnly} from '@mm-redux/selectors/entities/channels';
import {getCurrentChannel, getChannel, isChannelReadOnlyById} from '@mm-redux/selectors/entities/channels';
import {haveIChannelPermission} from '@mm-redux/selectors/entities/roles';
import {getTheme} from '@mm-redux/selectors/entities/preferences';
import {getCurrentUserId} from '@mm-redux/selectors/entities/users';
@ -14,7 +14,7 @@ import {getChannelMembersForDm} from '@selectors/channel';
import PostDraft from './post_draft';
export function mapStateToProps(state, ownProps) {
const channel = ownProps.rootId ? getChannel(state) : getCurrentChannel(state);
const channel = ownProps.rootId ? getChannel(state, ownProps.channelId) : getCurrentChannel(state);
const currentUserId = getCurrentUserId(state);
const channelId = ownProps.channelId || (channel ? channel.id : '');
let canPost = true;
@ -41,7 +41,7 @@ export function mapStateToProps(state, ownProps) {
let channelIsReadOnly = false;
if (currentUserId && channelId) {
channelIsReadOnly = isCurrentChannelReadOnly(state) || false;
channelIsReadOnly = isChannelReadOnlyById(state, channelId) || false;
}
return {