DEV: remove user thread count route (#25385)

Removes a now redundant route for the user thread count.
This commit is contained in:
David Battersby 2024-01-24 10:32:34 +08:00 committed by GitHub
parent 9dfa31202e
commit 04d2ec45b4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 0 additions and 35 deletions

View File

@ -21,11 +21,4 @@ class Chat::Api::CurrentUserThreadsController < Chat::ApiController
on_model_not_found(:threads) { render json: success_json.merge(threads: []) }
end
end
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
end
end

View File

@ -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.

View File

@ -6,7 +6,6 @@ Chat::Engine.routes.draw do
get "/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"

View File

@ -29,24 +29,4 @@ describe Chat::Api::CurrentUserThreadsController do
end
end
end
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
end
end