about summary refs log tree commit diff
path: root/app/models
diff options
context:
space:
mode:
authorDavid Yip <yipdw@member.fsf.org>2017-12-30 17:20:07 -0600
committerDavid Yip <yipdw@member.fsf.org>2017-12-30 17:20:07 -0600
commit4cca1d1e7efce51eecb64489f412a7b8631f0aed (patch)
tree5259571423a25c9a478052599c5e3d04db7fc8bd /app/models
parente4944d065b6bd6c6718c27700971be832ed4861a (diff)
parentf4b80e6511f21b60f71ed182bb66ca6ef0ba9f66 (diff)
Merge remote-tracking branch 'origin/master' into merge-upstream
 Conflicts:
	app/controllers/auth/confirmations_controller.rb
Diffstat (limited to 'app/models')
-rw-r--r--app/models/form/admin_settings.rb4
-rw-r--r--app/models/status.rb6
-rw-r--r--app/models/user.rb15
3 files changed, 25 insertions, 0 deletions
diff --git a/app/models/form/admin_settings.rb b/app/models/form/admin_settings.rb
index c1d2cf420..dd629279c 100644
--- a/app/models/form/admin_settings.rb
+++ b/app/models/form/admin_settings.rb
@@ -30,6 +30,10 @@ class Form::AdminSettings
     :bootstrap_timeline_accounts=,
     :min_invite_role,
     :min_invite_role=,
+    :activity_api_enabled,
+    :activity_api_enabled=,
+    :peers_api_enabled,
+    :peers_api_enabled=,
     to: Setting
   )
 end
diff --git a/app/models/status.rb b/app/models/status.rb
index db3072571..cb18b0705 100644
--- a/app/models/status.rb
+++ b/app/models/status.rb
@@ -138,6 +138,7 @@ class Status < ApplicationRecord
   end
 
   after_create_commit :store_uri, if: :local?
+  after_create_commit :update_statistics, if: :local?
 
   around_create Mastodon::Snowflake::Callbacks
 
@@ -336,4 +337,9 @@ class Status < ApplicationRecord
   def set_local
     self.local = account.local?
   end
+
+  def update_statistics
+    return unless public_visibility? || unlisted_visibility?
+    ActivityTracker.increment('activity:statuses:local')
+  end
 end
diff --git a/app/models/user.rb b/app/models/user.rb
index 47bf22e17..fed9c4977 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