From 38fc1b498d971f7b33532c583b12e5dd3469af3c Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Fri, 29 Dec 2017 19:52:04 +0100 Subject: Add more instance stats APIs (#6125) * Add GET /api/v1/instance/peers API to reveal known domains * Add GET /api/v1/instance/activity API * Make new APIs disableable, exclude private statuses from activity stats * Fix code style issue * Fix week timestamps --- app/models/user.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'app/models/user.rb') diff --git a/app/models/user.rb b/app/models/user.rb index 578622fdf..3ce6517a6 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -122,9 +122,19 @@ class User < ApplicationRecord update!(disabled: false) end + def confirm + return if confirmed? + + super + update_statistics! + end + def confirm! + return if confirmed? + skip_confirmation! save! + update_statistics! end def promote! @@ -202,4 +212,9 @@ class User < ApplicationRecord def sanitize_languages filtered_languages.reject!(&:blank?) end + + def update_statistics! + BootstrapTimelineWorker.perform_async(account_id) + ActivityTracker.increment('activity:accounts:local') + end end -- cgit