Discourse Browser History

:discourse2: Summary Discourse Browser History suppresses updating of URL during topic navigation, and demonstrates how to add a custom setting to users, that is later passed back to current user (meaning you will have access to it on every page load)
:hammer_and_wrench: Repository Link https://github.com/discourse/browser_history
:open_book: Install Guide How to install plugins in Discourse

Features

  1. It adds a user preference to disable “replaceState” during topic navigation.
  2. It ensures the setting is shipped to clients with Discourse.User.current().

Important API notes:

To register custom_fields to be serialized with current user use:

DiscoursePluginRegistry.serialized_current_user_fields << "my_field"

To specify a type for a custom field use:

after_initialize do
  User.register_custom_field_type('my_field', :boolean)
end

It can be used to keep browser history less cluttered.

11 Likes