Skip to content
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

D&D file in atto: Disable submit button while the fils are processing. #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

JBThong
Copy link

@JBThong JBThong commented Jun 25, 2021

No description provided.

@JBThong
Copy link
Author

JBThong commented Jun 25, 2021

Hi @pauln,

Currently, we drag and drop the file in the atto we should disable submit button while file uploads are processing. It's consistent behavior in the moodle system.

Thanks you

@timhunt
Copy link

timhunt commented Jun 25, 2021

Thong asked me to haev a look at this change. I think fix fix is good for recent versions of Moodle, which have the new JS APIs we are calling.

However, https://github.com/pauln/moodle-atto_filedragdrop/blob/master/version.php#L27. So, either Paul must be prepared to increase the minimum required Moodle version, or we need to code this more defensively, so it only calls the functions if they exist.

@nguyenphuctien
Copy link

nguyenphuctien commented Jun 29, 2021

@JBThong,
You can check if the module is defined or not yet using this example:

if (require.specified('mock_service')) {
    require( [ 'mock_service' ], function (mock) {
         if (typeof mock.init !== "undefined") { 
              // safe to use the function
              mock.init();
          }
    });
}

@pauln
Copy link
Owner

pauln commented Jun 29, 2021

Thanks for this submission @JBThong, and thanks for looking at it @timhunt. I don't see any reason to overcomplicate things - if the APIs/functions in question are only available in newer versions of Moodle, let's just bump the minimum Moodle version to the earliest version which has everything needed - there isn't anything else to release for older Moodle versions, so we can just release a new plugin version for those Moodle versions which support the relevant APIs.

If you want to update this PR with the updated Moodle version requirement (I've been out of the Moodle development game for a while now, so I'll take your word on what that version is), I can sort out a plugin version bump and release.

@JBThong
Copy link
Author

JBThong commented Jul 4, 2021

Thanks your feedback, @pauln

I have updated the PR. The new code is more defensive. However, these fixes only affect the moodle with minimum version 2020061507.03 (Moodle 3.9.7), which supported the relevant APIs. So could you bump the version support of this plugin and release which fit Moodle's changes?

On another note, In moodle 4.0, the function name triggerUploadCompleted will replace by notifyUploadCompleted and the function name triggerUploadStarted will replace by notifyUploadStarted.

@timhunt
Copy link

timhunt commented Sep 30, 2021

Is this now ready to be merged?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants