Discourse Disable New Features Notice Plugin

Plugin for Discourse Admins

Discourse Disable New Features Notice

Why this Plugin?

Discourse recently added Ruby and EmberJS code to check for "new features" and to display these new features in the Discourse Admin Dashboard using a huge banner which must be manually dismissed.

3d7a1a1fc496678e76988d35adfc47aee9a8b672_2_690x164

How Does It Work?

# frozen_string_literal: true

# name: discourse-disable-new-features-notice
# about: Disables new features notices in admin dashboard
# version: 0.139
# date: 6 March 2020
# authors: Neo
# url: https://github.com/unixneo/discourse-disable-new-features-notice.git

PLUGIN_NAME = "discourse-disable-new-features-notice"

enabled_site_setting :enable_disable_new_features_notice

after_initialize do
  Admin::DashboardController.class_eval do
    before_action :mark_new_features_as_seen

    def new_features
      new_features = DiscourseUpdates.new_features
      has_unseen_features = DiscourseUpdates.has_unseen_features?(current_user.id)
      if SiteSetting.enable_disable_new_features_notice? && SiteSetting.disable_new_features_fixed_notice?
        new_features = nil
        has_unseen_features = false
      end
      data = {
        new_features: new_features,
        has_unseen_features: has_unseen_features,
        release_notes_link: AdminDashboardGeneralData.fetch_cached_stats["release_notes_link"]
      }   
      render json: data
    end

    private 
    def mark_new_features_as_seen
      if SiteSetting.enable_disable_new_features_notice? && SiteSetting.disable_new_features_dismissable_notice?
        DiscourseUpdates.mark_new_features_as_seen(current_user.id)
      end
    end
  end
end

Personally, I prefer not to hide HTML elements when I can easily just remove them from the DOM, hence, I wrote this plugin:

I'm not trying to be anti-social, but this huge notice in the admin panel can be annoying (especially the silly icons).

See Also:

Future Enhancements (Done)

I did not test it, but I assume Discourse moderators also see this huge banner. If anyone (or any moderators) want to see this notice in the admin panel, I can easily modify this plugin so Discourse admins can enter the user ids of those who wish to have this notice suppressed (as a site setting) so this notice can be disabled based on the user id. The current plugin disables this notice for everyone (the "hammer" approach).

3 Likes

Update

Without this plugin, we still see massive "new features" banner at the top of the admin dashboard.

In addition, the "new features" list at the bottom of the admin dashboard keeps growing without bounds; so I have revised this plugin:

PLUGIN_NAME = "discourse-disable-annoying-new-features-notice"

after_initialize do
  Admin::DashboardController.class_eval do
    before_action :mark_annoying_new_features_as_seen

    
    def new_features;end

    private 
    def mark_annoying_new_features_as_seen
      DiscourseUpdates.mark_new_features_as_seen(current_user.id)
    end
  end

In the future, I will add a small amount of code to enable / disable this plugin; including the two distinct areas (the "dismissible" top notice and the "always on' bottom info).

1 Like

This plugin, with new site settings, is fully tested and working as expected:

# frozen_string_literal: true

# name: discourse-disable-new-features-notice
# about: Disables new features notices in admin dashboard
# version: 0.139
# date: 6 March 2020
# authors: Neo
# url: https://github.com/unixneo/discourse-disable-new-features-notice.git

PLUGIN_NAME = "discourse-disable-new-features-notice"

enabled_site_setting :enable_disable_new_features_notice

after_initialize do
  Admin::DashboardController.class_eval do
    before_action :mark_new_features_as_seen

    def new_features
      new_features = DiscourseUpdates.new_features
      has_unseen_features = DiscourseUpdates.has_unseen_features?(current_user.id)
      if SiteSetting.enable_disable_new_features_notice? && SiteSetting.disable_new_features_fixed_notice?
        new_features = nil
        has_unseen_features = false
      end
      data = {
        new_features: new_features,
        has_unseen_features: has_unseen_features,
        release_notes_link: AdminDashboardGeneralData.fetch_cached_stats["release_notes_link"]
      }   
      render json: data
    end

    private 
    def mark_new_features_as_seen
      if SiteSetting.enable_disable_new_features_notice? && SiteSetting.disable_new_features_dismissable_notice?
        DiscourseUpdates.mark_new_features_as_seen(current_user.id)
      end
    end
  end
end


In a Nutshell

This plugin disabled this notice, both the fixed and dismissible versions (configurable):

1 Like