Change to use an unified constant for max media attachments per status (#29073)

Co-authored-by: Renaud Chaput <renchap@gmail.com>
This commit is contained in:
Tianwei DongandRenaud Chaput authored and GitHub committed 2024-07-08 08:10:57 +00:00
1 parent 1a37862a76
commit 36d819bef3
3 files changed
+5 -5

No files matched your search

+2 -2
View File
@@ -279,7 +279,7 @@ export function submitComposeFail(error) {
export function uploadCompose(files) {
return function (dispatch, getState) {
const uploadLimit = 4;
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 progress = new Array(files.length).fill(0);
@@ -299,7 +299,7 @@ export function uploadCompose(files) {
dispatch(uploadComposeRequest());
for (const [i, file] of Array.from(files).entries()) {
if (media.size + i > 3) break;
if (media.size + i > (uploadLimit - 1)) break;
const data = new FormData();
data.append('file', file);