From 0a6b0986685e6a54042b22ae01df4dd0aad9f6b0 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Tue, 12 Sep 2017 00:16:03 +0200 Subject: Fix count numbers from ActivityPub not being saved (#4899) They are marked as read-only by Rails, but we know what we are doing, so we are un-marking them as such. The mastodon:maintenance:update_counter_caches task is not really supposed to be run anymore (it was a one-time thing during an upgrade) however, just in case, I have modified it to not touch ActivityPub accounts. Also, no point writing to logger from these rake tasks, since they are not to be run from cron. Better to give stdout feedback. --- app/models/account.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'app/models') diff --git a/app/models/account.rb b/app/models/account.rb index 529334559..864b3cb6e 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -172,6 +172,10 @@ class Account < ApplicationRecord end class << self + def readonly_attributes + super - %w(statuses_count following_count followers_count) + end + def domains reorder(nil).pluck('distinct accounts.domain') end -- cgit