sforkowany z mirror/soapbox
Media gallery: Fix upload limit, hotfix for #150
rodzic
75412ca078
commit
8f532b1b92
|
@ -12,6 +12,7 @@ import { showAlert } from './alerts';
|
|||
import { defineMessages } from 'react-intl';
|
||||
import { openModal, closeModal } from './modal';
|
||||
import { getSettings } from './settings';
|
||||
import { getFeatures } from 'soapbox/utils/features';
|
||||
|
||||
let cancelFetchComposeSuggestionsAccounts;
|
||||
|
||||
|
@ -214,8 +215,8 @@ export function submitComposeFail(error) {
|
|||
export function uploadCompose(files) {
|
||||
return function(dispatch, getState) {
|
||||
if (!getState().get('me')) return;
|
||||
const uploadLimit = getFeatures(getState().get('instance')).attachmentLimit;
|
||||
|
||||
const uploadLimit = 4;
|
||||
const media = getState().getIn(['compose', 'media_attachments']);
|
||||
const progress = new Array(files.length).fill(0);
|
||||
let total = Array.from(files).reduce((a, v) => a + v.size, 0);
|
||||
|
@ -233,7 +234,7 @@ export function uploadCompose(files) {
|
|||
dispatch(uploadComposeRequest());
|
||||
|
||||
for (const [i, f] of Array.from(files).entries()) {
|
||||
if (media.size + i > 3) break;
|
||||
if (media.size + i > uploadLimit - 1) break;
|
||||
|
||||
resizeImage(f).then(file => {
|
||||
const data = new FormData();
|
||||
|
|
|
@ -455,7 +455,7 @@ class MediaGallery extends React.PureComponent {
|
|||
{ w: 100, h: '50%', t: '2px' },
|
||||
];
|
||||
}
|
||||
} else if (size === 4) {
|
||||
} else if (size >= 4) {
|
||||
if (
|
||||
(isPortrait(ar1) && isPortrait(ar2) && isPortrait(ar3) && isPortrait(ar4)) ||
|
||||
(isPortrait(ar1) && isPortrait(ar2) && isPortrait(ar3) && isNonConformingRatio(ar4)) ||
|
||||
|
|
Ładowanie…
Reference in New Issue