[Glitch] Change compose form to use server-provided post character limit
Port 805dba7f8d to glitch-soc
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
			
			
This commit is contained in:
		
							parent
							
								
									20615a516d
								
							
						
					
					
						commit
						6da69967d0
					
				|  | @ -15,7 +15,6 @@ import { WithOptionalRouterPropTypes, withOptionalRouter } from 'flavours/glitch | ||||||
| import AutosuggestInput from '../../../components/autosuggest_input'; | import AutosuggestInput from '../../../components/autosuggest_input'; | ||||||
| import AutosuggestTextarea from '../../../components/autosuggest_textarea'; | import AutosuggestTextarea from '../../../components/autosuggest_textarea'; | ||||||
| import { Button } from '../../../components/button'; | import { Button } from '../../../components/button'; | ||||||
| import { maxChars } from '../../../initial_state'; |  | ||||||
| import EmojiPickerDropdown from '../containers/emoji_picker_dropdown_container'; | import EmojiPickerDropdown from '../containers/emoji_picker_dropdown_container'; | ||||||
| import LanguageDropdown from '../containers/language_dropdown_container'; | import LanguageDropdown from '../containers/language_dropdown_container'; | ||||||
| import PollButtonContainer from '../containers/poll_button_container'; | import PollButtonContainer from '../containers/poll_button_container'; | ||||||
|  | @ -81,6 +80,7 @@ class ComposeForm extends ImmutablePureComponent { | ||||||
|     isInReply: PropTypes.bool, |     isInReply: PropTypes.bool, | ||||||
|     singleColumn: PropTypes.bool, |     singleColumn: PropTypes.bool, | ||||||
|     lang: PropTypes.string, |     lang: PropTypes.string, | ||||||
|  |     maxChars: PropTypes.number, | ||||||
|     ...WithOptionalRouterPropTypes |     ...WithOptionalRouterPropTypes | ||||||
|   }; |   }; | ||||||
| 
 | 
 | ||||||
|  | @ -116,7 +116,7 @@ class ComposeForm extends ImmutablePureComponent { | ||||||
|   }; |   }; | ||||||
| 
 | 
 | ||||||
|   canSubmit = () => { |   canSubmit = () => { | ||||||
|     const { isSubmitting, isChangingUpload, isUploading, anyMedia } = this.props; |     const { isSubmitting, isChangingUpload, isUploading, anyMedia, maxChars } = this.props; | ||||||
|     const fulltext = this.getFulltextForCharacterCounting(); |     const fulltext = this.getFulltextForCharacterCounting(); | ||||||
|     const isOnlyWhitespace = fulltext.length !== 0 && fulltext.trim().length === 0; |     const isOnlyWhitespace = fulltext.length !== 0 && fulltext.trim().length === 0; | ||||||
| 
 | 
 | ||||||
|  | @ -250,7 +250,7 @@ class ComposeForm extends ImmutablePureComponent { | ||||||
|   }; |   }; | ||||||
| 
 | 
 | ||||||
|   render () { |   render () { | ||||||
|     const { intl, onPaste, autoFocus, withoutNavigation } = this.props; |     const { intl, onPaste, autoFocus, withoutNavigation, maxChars } = this.props; | ||||||
|     const { highlighted } = this.state; |     const { highlighted } = this.state; | ||||||
|     const disabled = this.props.isSubmitting; |     const disabled = this.props.isSubmitting; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -73,6 +73,7 @@ const mapStateToProps = state => ({ | ||||||
|   sideArm: sideArmPrivacy(state), |   sideArm: sideArmPrivacy(state), | ||||||
|   media: state.getIn(['compose', 'media_attachments']), |   media: state.getIn(['compose', 'media_attachments']), | ||||||
|   mediaDescriptionConfirmation: state.getIn(['local_settings', 'confirm_missing_media_description']), |   mediaDescriptionConfirmation: state.getIn(['local_settings', 'confirm_missing_media_description']), | ||||||
|  |   maxChars: state.getIn(['server', 'server', 'configuration', 'statuses', 'max_characters'], 500), | ||||||
| }); | }); | ||||||
| 
 | 
 | ||||||
| const mapDispatchToProps = (dispatch, { intl }) => ({ | const mapDispatchToProps = (dispatch, { intl }) => ({ | ||||||
|  |  | ||||||
|  | @ -66,7 +66,6 @@ export const hasMultiColumnPath = initialPath === '/' | ||||||
|  * @property {boolean=} critical_updates_pending |  * @property {boolean=} critical_updates_pending | ||||||
|  * @property {InitialStateMeta} meta |  * @property {InitialStateMeta} meta | ||||||
|  * @property {object} local_settings |  * @property {object} local_settings | ||||||
|  * @property {number} max_toot_chars |  | ||||||
|  * @property {number} max_feed_hashtags |  * @property {number} max_feed_hashtags | ||||||
|  * @property {number} poll_limits |  * @property {number} poll_limits | ||||||
|  */ |  */ | ||||||
|  | @ -130,7 +129,6 @@ export const statusPageUrl = getMeta('status_page_url'); | ||||||
| export const sso_redirect = getMeta('sso_redirect'); | export const sso_redirect = getMeta('sso_redirect'); | ||||||
| 
 | 
 | ||||||
| // Glitch-soc-specific settings
 | // Glitch-soc-specific settings
 | ||||||
| export const maxChars = (initialState && initialState.max_toot_chars) || 500; |  | ||||||
| export const maxFeedHashtags = (initialState && initialState.max_feed_hashtags) || 4; | export const maxFeedHashtags = (initialState && initialState.max_feed_hashtags) || 4; | ||||||
| export const favouriteModal = getMeta('favourite_modal'); | export const favouriteModal = getMeta('favourite_modal'); | ||||||
| export const pollLimits = (initialState && initialState.poll_limits); | export const pollLimits = (initialState && initialState.poll_limits); | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue