Save the state of inline toggle as a hidden user preference
Feature Summary
A user will have the ability to switch between inline and table formats when Wikidiff2 is installed. Add a user preference that tracks this selection so the system can remember the format to load.
Implementation Details
No JS implementation options:
- Drop no-JS support
- Wrap the existing no-JS controls with a form that posts to a new special endpoint, which sets the preference and then redirects back to the diff page, which will then show the newly selected format. Similar to watch star.
- Make the preference be a non-hidden preference.
- Retain the diff-type query string parameter. Don't actually set the preference in no-JS mode.
Anonymous options:
- Just be broken
- Apologise for broken behaviour
- Retain diff-type query parameter stickiness and use it for this.
- In JS mode, refresh the page as if in no-JS mode, or rewrite self-links to include diff-type.
- Add a core concept of user-or-session options. On read, if the user cannot have user options, merge values from the current session with site defaults. Callers opt in. In ApiOptions, if the user cannot have user options, set a session cookie if necessary and write to the session. Clients opt in.
- Variant: same but specific to diff types. Add a new API module just for setting the diff type.
- Use localStorage like T339268. Generate the complete diff in the wrong format on the server side and have the client replace it on DOM ready, to work around the lack of anonymous server-side preferences.
- Use a cookie just for anonymous diff type.