-
Notifications
You must be signed in to change notification settings - Fork 52
DEV: Use cookie instead of URL param to show original content #273
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
The head ref may contain hidden characters: "show-original-w-\u{1F36A}"
Conversation
aafb500 to
84323cc
Compare
|
To avoid cache poisoning, this cookie will need to be added to the AnonymousCache middleware key. (I think there's a plugin API for that?) |
| } | ||
| window.location.search = params.toString(); | ||
|
|
||
| window.location.reload(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Random thought... would calling .refresh() on the Ember router service be enough here? In theory that should re-run all model() hooks on routes? Might be a smoother experience than a full page reload?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right - weirdly, I included the router already but hadn't called refresh. This is a much better experience ✨
As we move content localization to core, we will need to register a new key to handle cases when anon users hit the cache to avoid cache poisoning. Related: - discourse/discourse-translator#273 - https://github.com/discourse/discourse-translator/blob/d7ae61198185705a3e03c14b2ce5a01dffbb1be2/lib/discourse_translator/inline_translation.rb#L94-L98
As we move content localization to core, we will need to register a new key to handle cases when anon users hit the cache to avoid cache poisoning. Related: - discourse/discourse-translator#273 - https://github.com/discourse/discourse-translator/blob/d7ae61198185705a3e03c14b2ce5a01dffbb1be2/lib/discourse_translator/inline_translation.rb#L94-L98
Currently when the "Show Original" button on the right side of the page is clicked, we append the param
?show=originaland trigger a refresh to show the original user-written post content.With this PR, we will be using cookies (
discourse-translator-show-original) instead. This cookie is applied site-wide, not per-topic.