Media gallery: Fix upload limit, hotfix for #150

stable/1.0.x
Alex Gleason 2020-06-07 14:40:54 -05:00
rodzic 75412ca078
commit 8f532b1b92
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
2 zmienionych plików z 4 dodań i 3 usunięć

Wyświetl plik

@ -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();

Wyświetl plik

@ -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)) ||