Updated submitCompose to take in groupId intead of group
• Updated: - submitCompose to take in groupId intead of group
This commit is contained in:
parent
84106dbe99
commit
1c1bfabb17
@ -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']),
|
||||
|
@ -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 = () => {
|
||||
|
@ -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() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user