MDL-54551 core: touch-up after review
authorMark Nelson <markn@moodle.com>
Wed, 18 Jul 2018 09:52:34 +0000 (17:52 +0800)
committerMark Nelson <markn@moodle.com>
Wed, 18 Jul 2018 10:08:37 +0000 (18:08 +0800)
1. Reworded the string.
2. Removed logic handling form data.
3. Do not use window.location.replace.

lang/en/webservice.php
lib/amd/build/ajax.min.js
lib/amd/src/ajax.js

index 20af1fe..1aac870 100644 (file)
@@ -186,7 +186,7 @@ $string['service'] = 'Service';
 $string['servicehelpexplanation'] = 'A service is a set of functions. A service can be accessed by all users or just specified users.';
 $string['servicename'] = 'Service name';
 $string['servicenotavailable'] = 'Web service is not available (it doesn\'t exist or might be disabled)';
-$string['servicerequireslogin'] = 'Web service requires login (the session has been logged out or has expired. Please save any work on the current page before continuing)';
+$string['servicerequireslogin'] = 'Web service is not available (the session has been logged out or has expired)';
 $string['servicesbuiltin'] = 'Built-in services';
 $string['servicescustom'] = 'Custom services';
 $string['serviceusers'] = 'Authorised users';
index 8a6dfe4..a585b99 100644 (file)
Binary files a/lib/amd/build/ajax.min.js and b/lib/amd/build/ajax.min.js differ
index 3130fdc..088deca 100644 (file)
@@ -25,7 +25,7 @@
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  * @since      2.9
  */
-define(['jquery', 'core/config', 'core/log', 'core/yui', 'core/url'], function($, config, Log, Y, URL) {
+define(['jquery', 'core/config', 'core/log', 'core/url'], function($, config, Log, URL) {
 
     // Keeps track of when the user leaves the page so we know not to show an error.
     var unloading = false;
@@ -81,13 +81,7 @@ define(['jquery', 'core/config', 'core/log', 'core/yui', 'core/url'], function($
         if (exception !== null) {
             // If the user isn't doing anything too important, redirect to the login page.
             if (exception.errorcode === "servicerequireslogin") {
-                Y.use('moodle-core-formchangechecker', function() {
-                    if (!M.core_formchangechecker.get_form_dirty_state()) {
-                        // If we reach here, the user isn't editing anything on the page.
-                        var loginUrl = URL.relativeUrl("/login/index.php");
-                        window.location.replace(loginUrl);
-                    }
-                });
+                window.location = URL.relativeUrl("/login/index.php");
             } else {
                 for (; i < requests.length; i++) {
                     request = requests[i];