Merge branch 'use-description-limit' into 'develop'

Use media description limits from Pleroma

See merge request soapbox-pub/soapbox-fe!631
groups
Alex Gleason 2021-07-19 21:32:17 +00:00
commit 62de87363a
4 zmienionych plików z 5 dodań i 2 usunięć

Wyświetl plik

@ -92,7 +92,7 @@ class Upload extends ImmutablePureComponent {
} }
render() { render() {
const { intl, media } = this.props; const { intl, media, descriptionLimit } = this.props;
const active = this.state.hovered || this.state.focused; const active = this.state.hovered || this.state.focused;
const description = this.state.dirtyDescription || (this.state.dirtyDescription !== '' && media.get('description')) || ''; const description = this.state.dirtyDescription || (this.state.dirtyDescription !== '' && media.get('description')) || '';
const focusX = media.getIn(['meta', 'focus', 'x']); const focusX = media.getIn(['meta', 'focus', 'x']);
@ -125,7 +125,7 @@ class Upload extends ImmutablePureComponent {
<textarea <textarea
placeholder={intl.formatMessage(messages.description)} placeholder={intl.formatMessage(messages.description)}
value={description} value={description}
maxLength={420} maxLength={descriptionLimit}
onFocus={this.handleInputFocus} onFocus={this.handleInputFocus}
onChange={this.handleInputChange} onChange={this.handleInputChange}
onBlur={this.handleInputBlur} onBlur={this.handleInputBlur}

Wyświetl plik

@ -7,6 +7,7 @@ import { List as ImmutableList } from 'immutable';
const mapStateToProps = (state, { id }) => ({ const mapStateToProps = (state, { id }) => ({
media: state.getIn(['compose', 'media_attachments']).find(item => item.get('id') === id), media: state.getIn(['compose', 'media_attachments']).find(item => item.get('id') === id),
descriptionLimit: state.getIn(['instance', 'description_limit']),
}); });
const mapDispatchToProps = dispatch => ({ const mapDispatchToProps = dispatch => ({

Wyświetl plik

@ -5,6 +5,7 @@ describe('instance reducer', () => {
it('should return the initial state', () => { it('should return the initial state', () => {
expect(reducer(undefined, {})).toEqual(ImmutableMap({ expect(reducer(undefined, {})).toEqual(ImmutableMap({
max_toot_chars: 500, max_toot_chars: 500,
description_limit: 1500,
poll_limits: ImmutableMap({ poll_limits: ImmutableMap({
max_expiration: 2629746, max_expiration: 2629746,
max_option_chars: 25, max_option_chars: 25,

Wyświetl plik

@ -26,6 +26,7 @@ const nodeinfoToInstance = nodeinfo => {
// Set Mastodon defaults, overridden by Pleroma servers // Set Mastodon defaults, overridden by Pleroma servers
const initialState = ImmutableMap({ const initialState = ImmutableMap({
max_toot_chars: 500, max_toot_chars: 500,
description_limit: 1500,
poll_limits: ImmutableMap({ poll_limits: ImmutableMap({
max_expiration: 2629746, max_expiration: 2629746,
max_option_chars: 25, max_option_chars: 25,