Fix alt+enter changing visibility setting without sending toot when toot is empty
This commit is contained in:
		
							parent
							
								
									0cbd6d696b
								
							
						
					
					
						commit
						40798cba41
					
				
					 1 changed files with 6 additions and 6 deletions
				
			
		| 
						 | 
					@ -93,7 +93,7 @@ class ComposeForm extends ImmutablePureComponent {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  handleSubmit = () => {
 | 
					  handleSubmit = (overriddenVisibility = null) => {
 | 
				
			||||||
    const { textarea: { value }, uploadForm } = this;
 | 
					    const { textarea: { value }, uploadForm } = this;
 | 
				
			||||||
    const {
 | 
					    const {
 | 
				
			||||||
      onChange,
 | 
					      onChange,
 | 
				
			||||||
| 
						 | 
					@ -106,6 +106,7 @@ class ComposeForm extends ImmutablePureComponent {
 | 
				
			||||||
      text,
 | 
					      text,
 | 
				
			||||||
      mediaDescriptionConfirmation,
 | 
					      mediaDescriptionConfirmation,
 | 
				
			||||||
      onMediaDescriptionConfirm,
 | 
					      onMediaDescriptionConfirm,
 | 
				
			||||||
 | 
					      onChangeVisibility,
 | 
				
			||||||
    } = this.props;
 | 
					    } = this.props;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    //  If something changes inside the textarea, then we update the
 | 
					    //  If something changes inside the textarea, then we update the
 | 
				
			||||||
| 
						 | 
					@ -124,6 +125,9 @@ class ComposeForm extends ImmutablePureComponent {
 | 
				
			||||||
      const firstWithoutDescription = media.find(item => !item.get('description'));
 | 
					      const firstWithoutDescription = media.find(item => !item.get('description'));
 | 
				
			||||||
      onMediaDescriptionConfirm(this.context.router ? this.context.router.history : null, firstWithoutDescription.get('id'));
 | 
					      onMediaDescriptionConfirm(this.context.router ? this.context.router.history : null, firstWithoutDescription.get('id'));
 | 
				
			||||||
    } else if (onSubmit) {
 | 
					    } else if (onSubmit) {
 | 
				
			||||||
 | 
					      if (onChangeVisibility && overriddenVisibility) {
 | 
				
			||||||
 | 
					        onChangeVisibility(overriddenVisibility);
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
      onSubmit(this.context.router ? this.context.router.history : null);
 | 
					      onSubmit(this.context.router ? this.context.router.history : null);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
| 
						 | 
					@ -152,13 +156,9 @@ class ComposeForm extends ImmutablePureComponent {
 | 
				
			||||||
  //  Handles the secondary submit button.
 | 
					  //  Handles the secondary submit button.
 | 
				
			||||||
  handleSecondarySubmit = () => {
 | 
					  handleSecondarySubmit = () => {
 | 
				
			||||||
    const {
 | 
					    const {
 | 
				
			||||||
      onChangeVisibility,
 | 
					 | 
				
			||||||
      sideArm,
 | 
					      sideArm,
 | 
				
			||||||
    } = this.props;
 | 
					    } = this.props;
 | 
				
			||||||
    if (sideArm !== 'none' && onChangeVisibility) {
 | 
					    this.handleSubmit(sideArm === 'none' ? null : sideArm);
 | 
				
			||||||
      onChangeVisibility(sideArm);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    this.handleSubmit();
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  //  Selects a suggestion from the autofill.
 | 
					  //  Selects a suggestion from the autofill.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue