mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 03:40:00 +08:00
DEV: remove user thread count route (#25385)
Removes a now redundant route for the user thread count.
This commit is contained in:
parent
9dfa31202e
commit
04d2ec45b4
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user