FEATURE: add new user option `skip_new_user_tips`. (#10437)

FEATURE: add new user option skip_new_user_tips. (#10437)

And add new site setting default_other_skip_new_user_tips in user preferences category.

diff --git a/app/assets/javascripts/admin/mixins/setting-component.js b/app/assets/javascripts/admin/mixins/setting-component.js
index 699cecd..44609e8 100644
--- a/app/assets/javascripts/admin/mixins/setting-component.js
+++ b/app/assets/javascripts/admin/mixins/setting-component.js
@@ -167,6 +167,7 @@ export default Mixin.create({
         "default_other_enable_defer",
         "default_other_dynamic_favicon",
         "default_other_like_notification_frequency",
+        "default_other_skip_new_user_tips",
         "default_topics_automatic_unpin",
         "default_categories_watching",
         "default_categories_tracking",
diff --git a/app/assets/javascripts/discourse/app/controllers/preferences/interface.js b/app/assets/javascripts/discourse/app/controllers/preferences/interface.js
index 8b63f5b..dd80b40 100644
--- a/app/assets/javascripts/discourse/app/controllers/preferences/interface.js
+++ b/app/assets/javascripts/discourse/app/controllers/preferences/interface.js
@@ -43,7 +43,8 @@ export default Controller.extend({
       "homepage_id",
       "hide_profile_and_presence",
       "text_size",
-      "title_count_mode"
+      "title_count_mode",
+      "skip_new_user_tips"
     ];
 
     if (makeDefault) {
diff --git a/app/assets/javascripts/discourse/app/models/user.js b/app/assets/javascripts/discourse/app/models/user.js
index 2dca08a..6013cae 100644
--- a/app/assets/javascripts/discourse/app/models/user.js
+++ b/app/assets/javascripts/discourse/app/models/user.js
@@ -318,7 +318,8 @@ const User = RestModel.extend({
       "hide_profile_and_presence",
       "text_size",
       "title_count_mode",
-      "timezone"
+      "timezone",
+      "skip_new_user_tips"
     ];
 
     if (fields) {
diff --git a/app/assets/javascripts/discourse/app/templates/preferences/interface.hbs b/app/assets/javascripts/discourse/app/templates/preferences/interface.hbs
index c3d23b1..af40097 100644
--- a/app/assets/javascripts/discourse/app/templates/preferences/interface.hbs
+++ b/app/assets/javascripts/discourse/app/templates/preferences/interface.hbs
@@ -103,6 +103,7 @@
       onChange=(action (mut model.user_option.title_count_mode))
     }}
   </div>
+  {{preference-checkbox labelKey="user.skip_new_user_tips" checked=model.user_option.skip_new_user_tips  class="pref-new-user-tips"}}
 </div>
 
 {{plugin-outlet name="user-preferences-interface" args=(hash model=model save=(action "save"))}}
diff --git a/app/controllers/admin/site_settings_controller.rb b/app/controllers/admin/site_settings_controller.rb
index e56c7fa..46b7409 100644
--- a/app/controllers/admin/site_settings_controller.rb
+++ b/app/controllers/admin/site_settings_controller.rb
@@ -194,6 +194,7 @@ class Admin::SiteSettingsController < Admin::AdminController
       default_other_auto_track_topics_after_msecs: "auto_track_topics_after_msecs",
       default_other_notification_level_when_replying: "notification_level_when_replying",
       default_other_like_notification_frequency: "like_notification_frequency",
+      default_other_skip_new_user_tips: "skip_new_user_tips",
       default_email_digest_frequency: "digest_after_minutes",
       default_include_tl0_in_digests: "include_tl0_in_digests",
       default_text_size: "text_size_key",
diff --git a/app/models/user_option.rb b/app/models/user_option.rb
index 7a68727..8619e11 100644
--- a/app/models/user_option.rb
+++ b/app/models/user_option.rb
@@ -57,6 +57,7 @@ class UserOption < ActiveRecord::Base
     self.enable_defer = SiteSetting.default_other_enable_defer
     self.external_links_in_new_tab = SiteSetting.default_other_external_links_in_new_tab
     self.dynamic_favicon = SiteSetting.default_other_dynamic_favicon
+    self.skip_new_user_tips = SiteSetting.default_other_skip_new_user_tips
 
     self.new_topic_duration_minutes = SiteSetting.default_other_new_topic_duration_minutes
     self.auto_track_topics_after_msecs = SiteSetting.default_other_auto_track_topics_after_msecs
diff --git a/app/serializers/current_user_serializer.rb b/app/serializers/current_user_serializer.rb
index 290569a..d64f2d5 100644
--- a/app/serializers/current_user_serializer.rb
+++ b/app/serializers/current_user_serializer.rb
@@ -47,7 +47,8 @@ class CurrentUserSerializer < BasicUserSerializer
              :ignored_users,
              :title_count_mode,
              :timezone,
-             :featured_topic
+             :featured_topic,
+             :skip_new_user_tips
 
   def groups
     object.visible_groups.pluck(:id, :name).map { |id, name| { id: id, name: name.downcase } }
@@ -204,6 +205,10 @@ class CurrentUserSerializer < BasicUserSerializer
     object.user_option.mailing_list_mode
   end
 
+  def skip_new_user_tips
+    object.user_option.skip_new_user_tips
+  end
+
   def include_primary_group_id?
     object.primary_group_id.present?
   end
diff --git a/app/serializers/user_option_serializer.rb b/app/serializers/user_option_serializer.rb
index 0187bcc..fb6091a 100644
--- a/app/serializers/user_option_serializer.rb
+++ b/app/serializers/user_option_serializer.rb
@@ -30,7 +30,8 @@ class UserOptionSerializer < ApplicationSerializer
              :text_size,
              :text_size_seq,
              :title_count_mode,
-             :timezone
+             :timezone,
+             :skip_new_user_tips
 
   def auto_track_topics_after_msecs
     object.auto_track_topics_after_msecs || SiteSetting.default_other_auto_track_topics_after_msecs
diff --git a/app/services/user_updater.rb b/app/services/user_updater.rb
index 32446e0..8c0149b 100644
--- a/app/services/user_updater.rb
+++ b/app/services/user_updater.rb
@@ -43,7 +43,8 @@ class UserUpdater
     :hide_profile_and_presence,
     :text_size,
     :title_count_mode,
-    :timezone
+    :timezone,
+    :skip_new_user_tips
   ]
 
   def initialize(actor, user)
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index 46b2680..1fd701b 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -930,6 +930,7 @@ en:
       dismiss_notifications_tooltip: "Mark all unread notifications as read"
       first_notification: "Your first notification! Select it to begin."
       dynamic_favicon: "Show counts on browser icon"
+      skip_new_user_tips: "Skip new user onboarding tips and badges"
       theme_default_on_all_devices: "Make this the default theme on all my devices"
       dark_mode: "Dark Mode"
       dark_mode_enable: "Enable automatic dark mode color scheme"
diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml
index cfa0a44..ee30f95 100644
--- a/config/locales/server.en.yml
+++ b/config/locales/server.en.yml
@@ -2157,6 +2157,7 @@ en:
     default_other_enable_quoting: "Enable quote reply for highlighted text by default."
     default_other_enable_defer: "Enable defer topic functionality by default."
     default_other_dynamic_favicon: "Show new/updated topic count on browser icon by default."
+    default_other_skip_new_user_tips: "Skip new user onboarding tips and badges."
 
     default_other_like_notification_frequency: "Notify users on likes by default"
 
diff --git a/config/site_settings.yml b/config/site_settings.yml
index a01d6eb..4a828f2 100644
--- a/config/site_settings.yml
+++ b/config/site_settings.yml
@@ -2133,6 +2133,7 @@ user_preferences:
   default_other_enable_quoting: true
   default_other_enable_defer: false
   default_other_dynamic_favicon: false
+  default_other_skip_new_user_tips: false
   default_other_like_notification_frequency:
     enum: "LikeNotificationFrequencySiteSetting"
     default: 1
diff --git a/db/migrate/20200814081437_add_skip_new_user_tips_to_user_options.rb b/db/migrate/20200814081437_add_skip_new_user_tips_to_user_options.rb
new file mode 100644
index 0000000..68f5d1f
--- /dev/null
+++ b/db/migrate/20200814081437_add_skip_new_user_tips_to_user_options.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class AddSkipNewUserTipsToUserOptions < ActiveRecord::Migration[6.0]
+  def change

[... diff too long, it was truncated ...]

GitHub sha: 476d2615

1 Like

This commit appears in #10437 which was merged by vinothkannans.