Profile editing: Uploading avatar and header images (#38189)
This commit is contained in:
14 files changed
+647
-39
No files matched your search
@@ -103,7 +103,11 @@ const mapStateToProps = state => ({
|
||||
layout: state.getIn(['meta', 'layout']),
|
||||
isComposing: state.getIn(['compose', 'is_composing']),
|
||||
hasComposingContents: state.getIn(['compose', 'text']).trim().length !== 0 || state.getIn(['compose', 'media_attachments']).size > 0 || state.getIn(['compose', 'poll']) !== null || state.getIn(['compose', 'quoted_status_id']) !== null,
|
||||
canUploadMore: !state.getIn(['compose', 'media_attachments']).some(x => ['audio', 'video'].includes(x.get('type'))) && state.getIn(['compose', 'media_attachments']).size < state.getIn(['server', 'server', 'configuration', 'statuses', 'max_media_attachments']),
|
||||
canUploadMore:
|
||||
!state.getIn(['compose', 'media_attachments']).some(x => ['audio', 'video'].includes(x.get('type')))
|
||||
&& state.getIn(['compose', 'media_attachments']).size < state.getIn(['server', 'server', 'configuration', 'statuses', 'max_media_attachments']),
|
||||
isUploadEnabled:
|
||||
state.getIn(['compose', 'isDragDisabled']) !== true,
|
||||
firstLaunch: state.getIn(['settings', 'introductionVersion'], 0) < INTRODUCTION_VERSION,
|
||||
newAccount: !state.getIn(['accounts', me, 'note']) && !state.getIn(['accounts', me, 'bot']) && state.getIn(['accounts', me, 'following_count'], 0) === 0 && state.getIn(['accounts', me, 'statuses_count'], 0) === 0,
|
||||
username: state.getIn(['accounts', me, 'username']),
|
||||
@@ -324,6 +328,9 @@ class UI extends PureComponent {
|
||||
};
|
||||
|
||||
handleDragEnter = (e) => {
|
||||
if (!this.props.isUploadEnabled) {
|
||||
return;
|
||||
}
|
||||
e.preventDefault();
|
||||
|
||||
if (!this.dragTargets) {
|
||||
@@ -340,6 +347,9 @@ class UI extends PureComponent {
|
||||
};
|
||||
|
||||
handleDragOver = (e) => {
|
||||
if (!this.props.isUploadEnabled) {
|
||||
return;
|
||||
}
|
||||
if (this.dataTransferIsText(e.dataTransfer)) return false;
|
||||
|
||||
e.preventDefault();
|
||||
@@ -355,6 +365,9 @@ class UI extends PureComponent {
|
||||
};
|
||||
|
||||
handleDrop = (e) => {
|
||||
if (!this.props.isUploadEnabled) {
|
||||
return;
|
||||
}
|
||||
if (this.dataTransferIsText(e.dataTransfer)) return;
|
||||
|
||||
e.preventDefault();
|
||||
@@ -429,7 +442,6 @@ class UI extends PureComponent {
|
||||
document.addEventListener('dragover', this.handleDragOver, false);
|
||||
document.addEventListener('drop', this.handleDrop, false);
|
||||
document.addEventListener('dragleave', this.handleDragLeave, false);
|
||||
document.addEventListener('dragend', this.handleDragEnd, false);
|
||||
|
||||
if ('serviceWorker' in navigator) {
|
||||
navigator.serviceWorker.addEventListener('message', this.handleServiceWorkerPostMessage);
|
||||
@@ -456,7 +468,6 @@ class UI extends PureComponent {
|
||||
document.removeEventListener('dragover', this.handleDragOver);
|
||||
document.removeEventListener('drop', this.handleDrop);
|
||||
document.removeEventListener('dragleave', this.handleDragLeave);
|
||||
document.removeEventListener('dragend', this.handleDragEnd);
|
||||
}
|
||||
|
||||
setRef = c => {
|
||||
|
||||
Reference in new issue
Block a user