about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCutls <web-pro@cutls.com>2022-11-12 05:19:48 +0900
committerGitHub <noreply@github.com>2022-11-11 21:19:48 +0100
commit553b169d483e9b2f28007e130a494aec08a1720a (patch)
tree7ee89c6e5bb39e02c1d961696f5337e34b443de9
parent5e796dc6f85b37c8378fe01cfd8ac23222c89eea (diff)
Do not show drag&drop dialog when not logined (#20400)
* Cannot upload until login

* and do not fire upload

* change username props to context
-rw-r--r--app/javascript/mastodon/features/ui/index.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/app/javascript/mastodon/features/ui/index.js b/app/javascript/mastodon/features/ui/index.js
index 298f2111d..b05956606 100644
--- a/app/javascript/mastodon/features/ui/index.js
+++ b/app/javascript/mastodon/features/ui/index.js
@@ -290,7 +290,7 @@ class UI extends React.PureComponent {
       this.dragTargets.push(e.target);
     }
 
-    if (e.dataTransfer && Array.from(e.dataTransfer.types).includes('Files') && this.props.canUploadMore) {
+    if (e.dataTransfer && Array.from(e.dataTransfer.types).includes('Files') && this.props.canUploadMore && this.context.identity.signedIn) {
       this.setState({ draggingOver: true });
     }
   }
@@ -318,7 +318,7 @@ class UI extends React.PureComponent {
     this.setState({ draggingOver: false });
     this.dragTargets = [];
 
-    if (e.dataTransfer && e.dataTransfer.files.length >= 1 && this.props.canUploadMore) {
+    if (e.dataTransfer && e.dataTransfer.files.length >= 1 && this.props.canUploadMore && this.context.identity.signedIn) {
       this.props.dispatch(uploadCompose(e.dataTransfer.files));
     }
   }