DEV: Rename settings from topic-chat to chat (#225)

DEV: Rename settings from topic-chat to chat (#225)

diff --git a/README.md b/README.md
index 9033e11..4dc0c67 100644
--- a/README.md
+++ b/README.md
@@ -10,7 +10,7 @@ This plugin allows moderators to turn any topic into a chatroom. Users can chat 
 
 ### Getting started
 
-Enable the `topic_chat_enabled` site setting, and use the 'Enable Chat' option in the topic wrench menu.
+Enable the `chat_enabled` site setting, and use the 'Enable Chat' option in the topic wrench menu.
 
 [image: enable chat]
 
diff --git a/app/controllers/chat_base_controller.rb b/app/controllers/chat_base_controller.rb
index 9ca25a7..7fd1fcd 100644
--- a/app/controllers/chat_base_controller.rb
+++ b/app/controllers/chat_base_controller.rb
@@ -7,7 +7,7 @@ class DiscourseChat::ChatBaseController < ::ApplicationController
   private
 
   def ensure_can_chat
-    raise Discourse::NotFound unless SiteSetting.topic_chat_enabled
+    raise Discourse::NotFound unless SiteSetting.chat_enabled
     guardian.ensure_can_chat!(current_user)
   end
 
diff --git a/app/controllers/move_to_topic_controller.rb b/app/controllers/move_to_topic_controller.rb
index 1a07e96..5c4614a 100644
--- a/app/controllers/move_to_topic_controller.rb
+++ b/app/controllers/move_to_topic_controller.rb
@@ -5,7 +5,7 @@ class DiscourseChat::MoveToTopicController < DiscourseChat::ChatBaseController
   EXISTING_TOPIC = "existingTopic"
   NEW_MESSAGE = "newMessage"
   def create
-    raise Discourse::NotFound unless SiteSetting.topic_chat_enabled
+    raise Discourse::NotFound unless SiteSetting.chat_enabled
 
     params.require([:type, :chat_message_ids, :chat_channel_id])
     chat_channel = ChatChannel.find_by(id: params[:chat_channel_id])
diff --git a/app/models/chat_channel.rb b/app/models/chat_channel.rb
index e59c1ac..75f55c4 100644
--- a/app/models/chat_channel.rb
+++ b/app/models/chat_channel.rb
@@ -89,7 +89,7 @@ class ChatChannel < ActiveRecord::Base
   end
 
   def self.is_enabled?(t)
-    return false if !SiteSetting.topic_chat_enabled
+    return false if !SiteSetting.chat_enabled
 
     ChatChannel.where(chatable: topic).exists?
   end
diff --git a/assets/javascripts/discourse/routes/chat-channel.js b/assets/javascripts/discourse/routes/chat-channel.js
index 5c64add..fd42c30 100644
--- a/assets/javascripts/discourse/routes/chat-channel.js
+++ b/assets/javascripts/discourse/routes/chat-channel.js
@@ -11,7 +11,7 @@ export default DiscourseRoute.extend({
   beforeModel() {
     if (
       !this.currentUser?.has_chat_enabled ||
-      !this.siteSettings.topic_chat_enabled
+      !this.siteSettings.chat_enabled
     ) {
       return this.transitionTo(`discovery.${defaultHomepage()}`);
     }
diff --git a/assets/javascripts/discourse/routes/chat.js b/assets/javascripts/discourse/routes/chat.js
index a526937..403cb0c 100644
--- a/assets/javascripts/discourse/routes/chat.js
+++ b/assets/javascripts/discourse/routes/chat.js
@@ -13,7 +13,7 @@ export default DiscourseRoute.extend({
   beforeModel(params) {
     if (
       !this.currentUser?.has_chat_enabled ||
-      !this.siteSettings.topic_chat_enabled
+      !this.siteSettings.chat_enabled
     ) {
       return this.transitionTo(`discovery.${defaultHomepage()}`);
     }
diff --git a/assets/javascripts/discourse/templates/components/category-chat-settings.hbs b/assets/javascripts/discourse/templates/components/category-chat-settings.hbs
index fe1c02b..23af289 100644
--- a/assets/javascripts/discourse/templates/components/category-chat-settings.hbs
+++ b/assets/javascripts/discourse/templates/components/category-chat-settings.hbs
@@ -1,4 +1,4 @@
-{{#if siteSettings.topic_chat_enabled}}
+{{#if siteSettings.chat_enabled}}
   <h3>{{i18n "chat.title"}}</h3>
   <section class="field">
     <label class="checkbox-label">
diff --git a/assets/javascripts/discourse/templates/components/tag-chat-settings.hbs b/assets/javascripts/discourse/templates/components/tag-chat-settings.hbs
index f732154..36682d3 100644
--- a/assets/javascripts/discourse/templates/components/tag-chat-settings.hbs
+++ b/assets/javascripts/discourse/templates/components/tag-chat-settings.hbs
@@ -1,4 +1,4 @@
-{{#if siteSettings.topic_chat_enabled}}
+{{#if siteSettings.chat_enabled}}
   {{d-button
     class="tag-chat-toggle"
     icon="comment"
diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml
index c9067a1..6caf87f 100644
--- a/config/locales/server.en.yml
+++ b/config/locales/server.en.yml
@@ -1,9 +1,7 @@
 en:
   site_settings:
-    topic_chat_enabled: "Enable the discourse-topic-chat plugin. Use the per-topic 'Enable Chat' action to set up."
-    topic_chat_allowed_groups: "Users in these groups can chat."
-    topic_chat_max_messages_per_post: "Maximum number of chat messages on the same post before the site will automatically create a new post. -1 to disable."
-    topic_chat_excerpt_maxlength: "Maximum length of post body that will appear in chat thread when a new post is created."
+    chat_enabled: "Enable the discourse-topic-chat plugin. Use the per-topic 'Enable Chat' action to set up."
+    chat_allowed_groups: "Users in these groups can chat."
   chat:
     separator_post_day:
       content: "Chat separation post for %{date}."
diff --git a/config/settings.yml b/config/settings.yml
index 35b0caf..2c971cc 100644
--- a/config/settings.yml
+++ b/config/settings.yml
@@ -1,17 +1,11 @@
 plugins:
-  topic_chat_enabled:
+  chat_enabled:
     default: false
     client: true
-  topic_chat_allowed_groups:
+  chat_allowed_groups:
     client: true
     type: group_list
     list_type: compact
     default: "3" # 3 is staff group id
     allow_any: false
     refresh: true
-  topic_chat_max_messages_per_post:
-    default: 1000
-    min: -1
-  topic_chat_excerpt_maxlength:
-    default: 30
-    min: 0
diff --git a/lib/extensions/topic_view_serializer_extension.rb b/lib/extensions/topic_view_serializer_extension.rb
index abb2d44..a59b110 100644
--- a/lib/extensions/topic_view_serializer_extension.rb
+++ b/lib/extensions/topic_view_serializer_extension.rb
@@ -7,7 +7,7 @@ module DiscourseChat::TopicViewSerializerExtension
   end
 
   def posts
-    if SiteSetting.topic_chat_enabled
+    if SiteSetting.chat_enabled
       posts = object.posts.includes(chat_message_post_connections: :chat_message)
       object.instance_variable_set(:@posts, posts)
     end
diff --git a/plugin.rb b/plugin.rb
index 29f4c94..0a94d51 100644
--- a/plugin.rb
+++ b/plugin.rb
@@ -7,7 +7,7 @@
 # url: https://github.com/discourse-org/discourse-topic-chat
 # transpile_js: true
 
-enabled_site_setting :topic_chat_enabled
+enabled_site_setting :chat_enabled
 
 register_asset 'stylesheets/common/common.scss'
 register_asset 'stylesheets/common/incoming-chat-webhooks.scss'
@@ -24,7 +24,7 @@ add_admin_route 'chat.admin.title', 'chat'
 
 after_initialize do
   module ::DiscourseChat
-    PLUGIN_NAME = "discourse-topic-chat"
+    PLUGIN_NAME = "discourse-chat"
     HAS_CHAT_ENABLED = "has_chat_enabled"
 
     SITE_CHAT_ID = -1
@@ -36,11 +36,11 @@ after_initialize do
     end
 
     def self.allowed_group_ids
-      SiteSetting.topic_chat_allowed_groups.to_s.split("|").map(&:to_i)
+      SiteSetting.chat_allowed_groups.to_s.split("|").map(&:to_i)
     end
   end
 
-  SeedFu.fixture_paths << Rails.root.join("plugins", "discourse-topic-chat", "db", "fixtures").to_s
+  SeedFu.fixture_paths << Rails.root.join("plugins", "discourse-chat", "db", "fixtures").to_s
 
   load File.expand_path('../app/controllers/admin/admin_incoming_chat_webhooks_controller.rb', __FILE__)
   load File.expand_path('../app/controllers/chat_base_controller.rb', __FILE__)
@@ -89,7 +89,7 @@ after_initialize do
   UserUpdater::OPTION_ATTR.push(:only_chat_push_notifications)
 
   on(:category_updated) do |category|
-    next if !SiteSetting.topic_chat_enabled
+    next if !SiteSetting.chat_enabled
 
     chat_channel = ChatChannel.with_deleted.find_by(chatable: category)
 
@@ -128,7 +128,7 @@ after_initialize do
   end
 

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

GitHub sha: fe8ac7b63b1b14c7ac3dd4b9675cff2d69c632cb

This commit appears in #225 which was approved by jomaxro. It was merged by markvanlan.