Issue Summary:
We use this module in an environment that also uses CloudFlare caching. The redirects work as needed, but the part that is not working for us is the system message - when a user is redirected because there is no translation. We are pretty sure that this is occurring because CloudFlare has cached the page(s) without a system message, so when someone is correctly redirected to one of the pages in cache, they will unfortunately not get the message as to why they were redirected. This is a break in the user-experience, and something we would like to remedy.
Possible Workaround:
We thought if we redirected with query string parameters, and if the page has been cached and there is no system message, then we can use JavaScript to insert a message into the DOM.
About the Patch:
The patch first looks to see if there is an existing query string [by looking for a question mark character (?)]. Then, it will be able to correctly append to the existing query string [or create a new query string].
The query string values we would like to add to the Drupal redirect, and then "read" with JavaScript are:
'translation=0'
and 'langcode=' . $current_language->getId()
What they are essentially signifying are:
From there, we will use a JavaScript to look for these query string values. If they exist, and are acceptable, being careful to check for XSS, then we can look to see if there is a system message already on the page. If not, we can generate the message by appending a div
with the message to where it belongs explaining to the user why they were redirected.
Thanks.
Fixed
1.1
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.