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

l10n.js - Reload when logging in as new user #13518

Merged
merged 1 commit into from
Feb 1, 2019

Conversation

colemanw
Copy link
Member

@colemanw colemanw commented Jan 31, 2019

Overview

Prevents a potential bug where clientside settings are served from a stale browser cache when switching users.

Before

Settings that depend on the user's permissions may not be correct when switching users. To reproduce:

  1. Log in as a user without "profile create" or "profile listings and forms" permission.
  2. Note that when using a contactRef widget on a form, no buttons are shown to create new contacts.
  3. Log out and back in as a user with the above permissions (without clearing browser caches).
  4. When using a contactRef widget on a form, the buttons should be there but they are not.
  5. Clear browser caches and the buttons will reappear.

image

After

Buttons always appear correctly.

@civibot
Copy link

civibot bot commented Jan 31, 2019

(Standard links)

@civibot civibot bot added the master label Jan 31, 2019
'r' => $this->getCacheCode(),
'cid' => CRM_Core_Session::getLoggedInContactID(),
];
$this->addScriptUrl(CRM_Utils_System::url('civicrm/ajax/l10n-js/' . $tsLocale, $args, FALSE, NULL, FALSE), $jsWeight++, $region);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@colemanw is there anything that is needed here to trigger the re-loading if the cid doesn't match or does it do that automatically?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changed value of the cid url param breaks browser caching so it reloads automatically.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the point is the url will be different & hence not treated the same?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep happy with that just wanted to double check the logic good to merge from me 👍

@eileenmcnaughton eileenmcnaughton merged commit efafa9a into civicrm:master Feb 1, 2019
@eileenmcnaughton eileenmcnaughton deleted the l10n.js branch February 1, 2019 00:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants