A platform for community discussion. Free, open, simple.
DEV: remove user thread count route (#25385)
David Battersby04d2ec45b4ce
diff --git a/plugins/chat/app/controllers/chat/api/current_user_threads_controller.rb b/plugins/chat/app/controllers/chat/api/current_user_threads_controller.rbindex f8bc218ab7c..5a2b5577990 100644--- a/plugins/chat/app/controllers/chat/api/current_user_threads_controller.rb+++ b/plugins/chat/app/controllers/chat/api/current_user_threads_controller.rb@@ -21,11 +21,4 @@ class Chat::Api::CurrentUserThreadsController < Chat::ApiControlleron_model_not_found(:threads) { render json: success_json.merge(threads: []) }endend-- def thread_count- with_service(::Chat::LookupUserThreads) do- on_success { render json: success_json.merge(thread_count: result.threads.size) }- on_model_not_found(:threads) { render json: success_json.merge(thread_count: 0) }- end- endenddiff --git a/plugins/chat/assets/javascripts/discourse/services/chat-api.js b/plugins/chat/assets/javascripts/discourse/services/chat-api.jsindex 0f5748fb4fc..2cea38c9c2c 100644--- a/plugins/chat/assets/javascripts/discourse/services/chat-api.js+++ b/plugins/chat/assets/javascripts/discourse/services/chat-api.js@@ -321,13 +321,6 @@ export default class ChatApi extends Service {return new Collection(`${this.#basePath}/me/threads`, handler);}- /**- * Get the total number of threads for the current user.- */- userThreadCount() {- return this.#getRequest("/me/threads/count");- }-/*** Update notifications settings of current user for a channel.* @param {number} channelId - The ID of the channel.diff --git a/plugins/chat/config/routes.rb b/plugins/chat/config/routes.rbindex d9379b209e6..ecf1be5adef 100644--- a/plugins/chat/config/routes.rb+++ b/plugins/chat/config/routes.rb@@ -6,7 +6,6 @@ Chat::Engine.routes.draw doget "/channels" => "channels#index"get "/me/channels" => "current_user_channels#index"get "/me/threads" => "current_user_threads#index"- get "/me/threads/count" => "current_user_threads#thread_count"post "/channels" => "channels#create"put "/channels/read/" => "reads#update_all"put "/channels/:channel_id/read/:message_id" => "reads#update"diff --git a/plugins/chat/spec/requests/chat/api/current_user_threads_spec.rb b/plugins/chat/spec/requests/chat/api/current_user_threads_spec.rbindex 5d6a7eb03ea..1e8577ba01f 100644--- a/plugins/chat/spec/requests/chat/api/current_user_threads_spec.rb+++ b/plugins/chat/spec/requests/chat/api/current_user_threads_spec.rb@@ -29,24 +29,4 @@ describe Chat::Api::CurrentUserThreadsController doendendend-- describe "#thread_count" do- describe "success" do- it "works" do- get "/chat/api/me/threads/count"-- expect(response.status).to eq(200)- expect(response.parsed_body["thread_count"]).to eq(0)- end- end-- context "when threads are not found" do- it "returns a 200 when there are no threads" do- get "/chat/api/me/threads/count"-- expect(response.status).to eq(200)- expect(response.parsed_body["thread_count"]).to eq(0)- end- end- endend