Merge pull request #2667 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes up to 653ce43abe
This commit is contained in:
commit
f407505f75
|
@ -357,7 +357,7 @@ GEM
|
||||||
jmespath (1.6.2)
|
jmespath (1.6.2)
|
||||||
json (2.7.1)
|
json (2.7.1)
|
||||||
json-canonicalization (1.0.0)
|
json-canonicalization (1.0.0)
|
||||||
json-jwt (1.15.3)
|
json-jwt (1.15.3.1)
|
||||||
activesupport (>= 4.2)
|
activesupport (>= 4.2)
|
||||||
aes_key_wrap
|
aes_key_wrap
|
||||||
bindata
|
bindata
|
||||||
|
|
|
@ -109,6 +109,7 @@ module LanguagesHelper
|
||||||
mn: ['Mongolian', 'Монгол хэл'].freeze,
|
mn: ['Mongolian', 'Монгол хэл'].freeze,
|
||||||
mr: ['Marathi', 'मराठी'].freeze,
|
mr: ['Marathi', 'मराठी'].freeze,
|
||||||
ms: ['Malay', 'Bahasa Melayu'].freeze,
|
ms: ['Malay', 'Bahasa Melayu'].freeze,
|
||||||
|
'ms-Arab': ['Jawi Malay', 'بهاس ملايو'].freeze,
|
||||||
mt: ['Maltese', 'Malti'].freeze,
|
mt: ['Maltese', 'Malti'].freeze,
|
||||||
my: ['Burmese', 'ဗမာစာ'].freeze,
|
my: ['Burmese', 'ဗမာစာ'].freeze,
|
||||||
na: ['Nauru', 'Ekakairũ Naoero'].freeze,
|
na: ['Nauru', 'Ekakairũ Naoero'].freeze,
|
||||||
|
@ -196,6 +197,7 @@ module LanguagesHelper
|
||||||
kab: ['Kabyle', 'Taqbaylit'].freeze,
|
kab: ['Kabyle', 'Taqbaylit'].freeze,
|
||||||
ldn: ['Láadan', 'Láadan'].freeze,
|
ldn: ['Láadan', 'Láadan'].freeze,
|
||||||
lfn: ['Lingua Franca Nova', 'lingua franca nova'].freeze,
|
lfn: ['Lingua Franca Nova', 'lingua franca nova'].freeze,
|
||||||
|
moh: ['Mohawk', 'Kanienʼkéha'].freeze,
|
||||||
pdc: ['Pennsylvania Dutch', 'Pennsilfaani-Deitsch'].freeze,
|
pdc: ['Pennsylvania Dutch', 'Pennsilfaani-Deitsch'].freeze,
|
||||||
sco: ['Scots', 'Scots'].freeze,
|
sco: ['Scots', 'Scots'].freeze,
|
||||||
sma: ['Southern Sami', 'Åarjelsaemien Gïele'].freeze,
|
sma: ['Southern Sami', 'Åarjelsaemien Gïele'].freeze,
|
||||||
|
|
|
@ -4,14 +4,24 @@ import { uploadCompose } from '../../../actions/compose';
|
||||||
import { openModal } from '../../../actions/modal';
|
import { openModal } from '../../../actions/modal';
|
||||||
import UploadButton from '../components/upload_button';
|
import UploadButton from '../components/upload_button';
|
||||||
|
|
||||||
const mapStateToProps = state => ({
|
const mapStateToProps = state => {
|
||||||
disabled: state.getIn(['compose', 'poll']) !== null || state.getIn(['compose', 'is_uploading']) || (state.getIn(['compose', 'media_attachments']).size + state.getIn(['compose', 'pending_media_attachments']) > 3 || state.getIn(['compose', 'media_attachments']).some(m => ['video', 'audio'].includes(m.get('type')))),
|
const isPoll = state.getIn(['compose', 'poll']) !== null;
|
||||||
resetFileKey: state.getIn(['compose', 'resetFileKey']),
|
const isUploading = state.getIn(['compose', 'is_uploading']);
|
||||||
});
|
const readyAttachmentsSize = state.getIn(['compose', 'media_attachments']).size ?? 0;
|
||||||
|
const pendingAttachmentsSize = state.getIn(['compose', 'pending_media_attachments']).size ?? 0;
|
||||||
|
const attachmentsSize = readyAttachmentsSize + pendingAttachmentsSize;
|
||||||
|
const isOverLimit = attachmentsSize > 3;
|
||||||
|
const hasVideoOrAudio = state.getIn(['compose', 'media_attachments']).some(m => ['video', 'audio'].includes(m.get('type')));
|
||||||
|
|
||||||
|
return {
|
||||||
|
disabled: isPoll || isUploading || isOverLimit || hasVideoOrAudio,
|
||||||
|
resetFileKey: state.getIn(['compose', 'resetFileKey']),
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
const mapDispatchToProps = dispatch => ({
|
const mapDispatchToProps = dispatch => ({
|
||||||
|
|
||||||
onSelectFile (files) {
|
onSelectFile(files) {
|
||||||
dispatch(uploadCompose(files));
|
dispatch(uploadCompose(files));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -3,14 +3,24 @@ import { connect } from 'react-redux';
|
||||||
import { uploadCompose } from '../../../actions/compose';
|
import { uploadCompose } from '../../../actions/compose';
|
||||||
import UploadButton from '../components/upload_button';
|
import UploadButton from '../components/upload_button';
|
||||||
|
|
||||||
const mapStateToProps = state => ({
|
const mapStateToProps = state => {
|
||||||
disabled: state.getIn(['compose', 'poll']) !== null || state.getIn(['compose', 'is_uploading']) || (state.getIn(['compose', 'media_attachments']).size + state.getIn(['compose', 'pending_media_attachments']) > 3 || state.getIn(['compose', 'media_attachments']).some(m => ['video', 'audio'].includes(m.get('type')))),
|
const isPoll = state.getIn(['compose', 'poll']) !== null;
|
||||||
resetFileKey: state.getIn(['compose', 'resetFileKey']),
|
const isUploading = state.getIn(['compose', 'is_uploading']);
|
||||||
});
|
const readyAttachmentsSize = state.getIn(['compose', 'media_attachments']).size ?? 0;
|
||||||
|
const pendingAttachmentsSize = state.getIn(['compose', 'pending_media_attachments']).size ?? 0;
|
||||||
|
const attachmentsSize = readyAttachmentsSize + pendingAttachmentsSize;
|
||||||
|
const isOverLimit = attachmentsSize > 3;
|
||||||
|
const hasVideoOrAudio = state.getIn(['compose', 'media_attachments']).some(m => ['video', 'audio'].includes(m.get('type')));
|
||||||
|
|
||||||
|
return {
|
||||||
|
disabled: isPoll || isUploading || isOverLimit || hasVideoOrAudio,
|
||||||
|
resetFileKey: state.getIn(['compose', 'resetFileKey']),
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
const mapDispatchToProps = dispatch => ({
|
const mapDispatchToProps = dispatch => ({
|
||||||
|
|
||||||
onSelectFile (files) {
|
onSelectFile(files) {
|
||||||
dispatch(uploadCompose(files));
|
dispatch(uploadCompose(files));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue