mirror of
https://github.com/mastodon/mastodon.git
synced 2024-12-22 18:45:41 +01:00
Rebase branch
This commit is contained in:
parent
7ed9c590b9
commit
34e3869006
1 changed files with 10 additions and 4 deletions
|
@ -301,11 +301,17 @@ export function uploadCompose(files) {
|
|||
const uploadLimit = getState().getIn(['server', 'server', 'configuration', 'statuses', 'max_media_attachments']);
|
||||
const media = getState().getIn(['compose', 'media_attachments']);
|
||||
const pending = getState().getIn(['compose', 'pending_media_attachments']);
|
||||
const serverConfiguration = getState().getIn(['server', 'server', 'configuration']);
|
||||
const maxMediaAttachments = serverConfiguration.getIn(['statuses', 'max_media_attachments']);
|
||||
const videoSizeLimit = serverConfiguration.getIn(['media_attachments', 'video_size_limit']);
|
||||
const imageSizeLimit = serverConfiguration.getIn(['media_attachments', 'image_size_limit']);
|
||||
const filesArray = Array.from(files);
|
||||
const progress = new Array(files.length).fill(0);
|
||||
|
||||
let total = Array.from(files).reduce((a, v) => a + v.size, 0);
|
||||
|
||||
if (files.length + media.size + pending > uploadLimit) {
|
||||
let total = filesArray.reduce((a, v) => a + v.size, 0);
|
||||
if (
|
||||
filesArray.some(file => (file.type.match(/video\/.*/) && file.size > videoSizeLimit)
|
||||
|| (file.type.match(/image\/.*/) && file.size > imageSizeLimit)
|
||||
|| (files.length + media.size + pending > maxMediaAttachments))) {
|
||||
dispatch(showAlert({ message: messages.uploadErrorLimit }));
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue