mirror of
https://github.com/discourse/discourse.git
synced 2025-05-28 01:56:58 +08:00
FEATURE: participating users statistics (#28322)
Adds a new statistics (hidden from the UI, but available via the API) that tracks daily participating users. A user is considered as "participating" if they have - Reacted to a post - Replied to a topic - Created a new topic - Created a new PM - Sent a chat message - Reacted to a chat message Internal ref - t/131013
This commit is contained in:
15
plugins/chat/spec/lib/statistics_spec.rb
Normal file
15
plugins/chat/spec/lib/statistics_spec.rb
Normal file
@ -0,0 +1,15 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
RSpec.describe Statistics do
|
||||
describe "#participating_users" do
|
||||
it "returns users who have sent a chat message" do
|
||||
Fabricate(:chat_message)
|
||||
expect(described_class.participating_users[:last_day]).to eq(1)
|
||||
end
|
||||
|
||||
it "returns users who have reacted to a chat message" do
|
||||
Fabricate(:chat_message_reaction)
|
||||
expect(described_class.participating_users[:last_day]).to eq(2) # 2 because the chat message creator is also counted
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user