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