Allow alt-text length to be customisable
parent
4c55a6ee73
commit
f123fc4a2b
|
@ -50,6 +50,7 @@ const mapStateToProps = (state, { id }) => ({
|
||||||
focusY: state.getIn(['compose', 'media_modal', 'focusY']),
|
focusY: state.getIn(['compose', 'media_modal', 'focusY']),
|
||||||
dirty: state.getIn(['compose', 'media_modal', 'dirty']),
|
dirty: state.getIn(['compose', 'media_modal', 'dirty']),
|
||||||
is_changing_upload: state.getIn(['compose', 'is_changing_upload']),
|
is_changing_upload: state.getIn(['compose', 'is_changing_upload']),
|
||||||
|
maxChars: state.getIn(['server', 'server', 'configuration', 'media_attachments', 'max_characters'], 1_500),
|
||||||
});
|
});
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch, { id }) => ({
|
const mapDispatchToProps = (dispatch, { id }) => ({
|
||||||
|
@ -279,7 +280,7 @@ class FocalPointModal extends ImmutablePureComponent {
|
||||||
};
|
};
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
const { media, intl, account, onClose, isUploadingThumbnail, description, lang, focusX, focusY, dirty, is_changing_upload } = this.props;
|
const { media, intl, account, onClose, isUploadingThumbnail, description, lang, focusX, focusY, dirty, is_changing_upload, maxChars } = this.props;
|
||||||
const { dragging, detecting, progress, ocrStatus } = this.state;
|
const { dragging, detecting, progress, ocrStatus } = this.state;
|
||||||
const x = (focusX / 2) + .5;
|
const x = (focusX / 2) + .5;
|
||||||
const y = (focusY / -2) + .5;
|
const y = (focusY / -2) + .5;
|
||||||
|
@ -375,7 +376,7 @@ class FocalPointModal extends ImmutablePureComponent {
|
||||||
>
|
>
|
||||||
<FormattedMessage id='upload_modal.detect_text' defaultMessage='Detect text from picture' />
|
<FormattedMessage id='upload_modal.detect_text' defaultMessage='Detect text from picture' />
|
||||||
</button>
|
</button>
|
||||||
<CharacterCounter max={1500} text={detecting ? '' : description} />
|
<CharacterCounter max={maxChars} text={detecting ? '' : description} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
|
|
|
@ -37,7 +37,7 @@ class MediaAttachment < ApplicationRecord
|
||||||
enum :type, { image: 0, gifv: 1, video: 2, unknown: 3, audio: 4 }
|
enum :type, { image: 0, gifv: 1, video: 2, unknown: 3, audio: 4 }
|
||||||
enum :processing, { queued: 0, in_progress: 1, complete: 2, failed: 3 }, prefix: true
|
enum :processing, { queued: 0, in_progress: 1, complete: 2, failed: 3 }, prefix: true
|
||||||
|
|
||||||
MAX_DESCRIPTION_LENGTH = 1_500
|
MAX_DESCRIPTION_LENGTH = (ENV['MAX_ATTACHMENT_DESCRIPTION'] || 1_500).to_i
|
||||||
|
|
||||||
IMAGE_LIMIT = (ENV['MAX_IMAGE_SIZE'] || 16.megabytes).to_i
|
IMAGE_LIMIT = (ENV['MAX_IMAGE_SIZE'] || 16.megabytes).to_i
|
||||||
VIDEO_LIMIT = (ENV['MAX_VIDEO_SIZE'] || 99.megabytes).to_i
|
VIDEO_LIMIT = (ENV['MAX_VIDEO_SIZE'] || 99.megabytes).to_i
|
||||||
|
|
|
@ -84,6 +84,7 @@ class REST::V1::InstanceSerializer < ActiveModel::Serializer
|
||||||
|
|
||||||
media_attachments: {
|
media_attachments: {
|
||||||
supported_mime_types: MediaAttachment::IMAGE_MIME_TYPES + MediaAttachment::VIDEO_MIME_TYPES + MediaAttachment::AUDIO_MIME_TYPES,
|
supported_mime_types: MediaAttachment::IMAGE_MIME_TYPES + MediaAttachment::VIDEO_MIME_TYPES + MediaAttachment::AUDIO_MIME_TYPES,
|
||||||
|
max_characters: MediaAttachment::MAX_DESCRIPTION_LENGTH,
|
||||||
image_size_limit: MediaAttachment::IMAGE_LIMIT,
|
image_size_limit: MediaAttachment::IMAGE_LIMIT,
|
||||||
image_matrix_limit: Attachmentable::MAX_MATRIX_LIMIT,
|
image_matrix_limit: Attachmentable::MAX_MATRIX_LIMIT,
|
||||||
video_size_limit: MediaAttachment::VIDEO_LIMIT,
|
video_size_limit: MediaAttachment::VIDEO_LIMIT,
|
||||||
|
|
Loading…
Reference in New Issue