diff --git a/app/javascript/gabsocial/actions/compose.js b/app/javascript/gabsocial/actions/compose.js index 87b9c54d..860f6268 100644 --- a/app/javascript/gabsocial/actions/compose.js +++ b/app/javascript/gabsocial/actions/compose.js @@ -260,7 +260,7 @@ export function handleComposeSubmit(dispatch, getState, response, status) { } } -export function submitCompose(group, replyToId = null, router, isStandalone) { +export function submitCompose(groupId, replyToId = null, router, isStandalone) { return function (dispatch, getState) { if (!me) return; @@ -311,7 +311,7 @@ export function submitCompose(group, replyToId = null, router, isStandalone) { spoiler_text: getState().getIn(['compose', 'spoiler_text'], ''), visibility: getState().getIn(['compose', 'privacy']), poll: getState().getIn(['compose', 'poll'], null), - group_id: group ? group.get('id') : null, + group_id: groupId || null, }, { headers: { 'Idempotency-Key': getState().getIn(['compose', 'idempotencyKey']), diff --git a/app/javascript/gabsocial/features/compose/components/compose_form.js b/app/javascript/gabsocial/features/compose/components/compose_form.js index 1e15e88a..4b0a2265 100644 --- a/app/javascript/gabsocial/features/compose/components/compose_form.js +++ b/app/javascript/gabsocial/features/compose/components/compose_form.js @@ -141,14 +141,15 @@ class ComposeForm extends ImmutablePureComponent { // } // Submit disabled: - const { isSubmitting, isChangingUpload, isUploading, anyMedia } = this.props; + const { isSubmitting, isChangingUpload, isUploading, anyMedia, group } = this.props; const fulltext = [this.props.spoilerText, countableText(this.props.text)].join(''); if (isSubmitting || isUploading || isChangingUpload || length(fulltext) > MAX_POST_CHARACTER_COUNT || (fulltext.length !== 0 && fulltext.trim().length === 0 && !anyMedia)) { return; } - this.props.onSubmit(this.props.group, this.props.replyToId, this.context.router); + const groupId = group ? group.get('id') : undefined + this.props.onSubmit(groupId, this.props.replyToId, this.context.router); } onSuggestionsClearRequested = () => { diff --git a/app/javascript/gabsocial/features/compose/containers/compose_form_container.js b/app/javascript/gabsocial/features/compose/containers/compose_form_container.js index ba216bb6..9f336551 100644 --- a/app/javascript/gabsocial/features/compose/containers/compose_form_container.js +++ b/app/javascript/gabsocial/features/compose/containers/compose_form_container.js @@ -102,8 +102,8 @@ const mapDispatchToProps = (dispatch, { isStandalone }) => ({ dispatch(changeCompose(text, markdown, newReplyToId, isStandalone, position)) }, - onSubmit(group, replyToId, router) { - dispatch(submitCompose(group, replyToId, router, isStandalone)) + onSubmit(groupId, replyToId, router) { + dispatch(submitCompose(groupId, replyToId, router, isStandalone)) }, onClearSuggestions() {