-
Notifications
You must be signed in to change notification settings - Fork 13.7k
[FIX] Drag and drop disabled when file upload is disabled #16049
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -253,7 +253,28 @@ callbacks.add('enter-room', wipeFailedUploads); | |
|
|
||
| const ignoreReplies = getConfig('ignoreReplies') === 'true'; | ||
|
|
||
| export const dropzoneHelpers = { | ||
| dragAndDrop() { | ||
| return settings.get('FileUpload_Enabled') && 'dropzone--disabled'; | ||
| }, | ||
|
|
||
| isDropzoneDisabled() { | ||
| return settings.get('FileUpload_Enabled') ? 'dropzone-overlay--enabled' : 'dropzone-overlay--disabled'; | ||
| }, | ||
|
|
||
| dragAndDropLabel() { | ||
| if (!userCanDrop) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should be |
||
| return 'error-not-allowed'; | ||
| } | ||
| if (!settings.get('FileUpload_Enabled')) { | ||
| return 'FileUpload_Disabled'; | ||
| } | ||
| return 'Drop_to_upload_file'; | ||
| }, | ||
| }; | ||
|
|
||
| Template.room.helpers({ | ||
| ...dropzoneHelpers, | ||
| useNrr() { | ||
| const useNrr = getConfig('useNrr'); | ||
| return useNrr === 'true' || useNrr !== 'false'; | ||
|
|
@@ -585,6 +606,11 @@ export const dropzoneEvents = { | |
| const e = event.originalEvent || event; | ||
|
|
||
| e.stopPropagation(); | ||
| e.preventDefault(); | ||
|
|
||
| if (!userCanDrop() || !settings.get('FileUpload_Enabled')) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think here we can add the
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, this check can be done earlier in the event, maybe right after removing the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here: |
||
| return false; | ||
| } | ||
|
|
||
| let files = (e.dataTransfer && e.dataTransfer.files) || []; | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.