Don’t load a 2nd copy of jQuery on mobile login
Fixes: CORE-3190 (again) we tried fixing this jira in g/201294 but it still Doesn’t work for schools that have a custom JS file We used to not load any of our webpack code on the mobile login screen and so we needed to load a bare copy of jQuery so that accounts with Custom JS files could rely on it. But as of a while ago, we do load our own webpack bundles on that Page, which means we now set a global window.jQuery variable. Which means by loading a second copy, it was causing things to break because things that relied on the global window.jQuery variable would get one copy of jQuery and anything that used webpack to `import $ from ‘jquery’` would get a different copy. and the module ‘jquery-ui-touch-punch’ was just relying on looking for the global window.jQuery and so it broke because `jqueryUI mouse` was not present in that copy of jquery. Test plan: * you have to do this with a fully minified prod webpack build like on portals * have a custom js file set up in the theme editor that does something Like `alert(‘I got loaded and this is jQuery version ’ + $.fn.jquery)` * go to the mobile login page on a mobile device or using a browser with The mobile device simulator * your custom JS should load (aka it should alert) * no errors should be present in the console * click on the “forgot password” link * it should work Change-Id: I0c38d2bf08f748d60a8df2d993907edb1e1bf331 Reviewed-on: https://gerrit.instructure.com/201656 Reviewed-by: Clay Diffrient <cdiffrient@instructure.com> Tested-by: Jenkins QA-Review: Clay Diffrient <cdiffrient@instructure.com> Product-Review: Clay Diffrient <cdiffrient@instructure.com>
This commit is contained in:
parent
0352326afa
commit
3df51b35ee
|
@ -688,7 +688,7 @@ module ApplicationHelper
|
|||
end
|
||||
private :brand_config_account
|
||||
|
||||
def include_account_js(options = {})
|
||||
def include_account_js
|
||||
return if params[:global_includes] == '0' || !@domain_root_account
|
||||
|
||||
includes = if @domain_root_account.allow_global_includes? && (abc = active_brand_config(ignore_high_contrast_preference: true))
|
||||
|
@ -698,7 +698,6 @@ module ApplicationHelper
|
|||
end
|
||||
|
||||
if includes.present?
|
||||
includes.unshift("/node_modules/jquery/jquery.js") if options[:raw]
|
||||
javascript_include_tag(*includes, defer: true)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -93,6 +93,6 @@
|
|||
s.parentNode.insertBefore(g,s)}(document,"script"));
|
||||
</script>
|
||||
<%= include_js_bundles %>
|
||||
<%= include_account_js(raw: true) %>
|
||||
<%= include_account_js %>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -73,11 +73,6 @@ gulp.task('rev', () => {
|
|||
follow: true // follow symlinks, so it picks up on images inside plugins and stuff
|
||||
}),
|
||||
gulp.src([
|
||||
// on the mobile login screen, we don't load any of our webpack js bundles. but if they
|
||||
// have a custom js file, we do load a raw copy of jquery for their custom js to use.
|
||||
// See `include_account_js` in mobile_auth.html.erb
|
||||
'node_modules/jquery/jquery.js',
|
||||
|
||||
'node_modules/tinymce/skins/lightgray/**/*',
|
||||
], {
|
||||
base: '.'
|
||||
|
|
Loading…
Reference in New Issue