manually update counters (#3757)

This commit is contained in:
Albert Yi
2018-06-21 13:50:39 -07:00
parent 02d449c514
commit df73c682db

View File

@@ -775,10 +775,10 @@ class User < ApplicationRecord
def refresh_counts!
self.class.without_timeout do
update(
User.where(id: id).update_all(
post_upload_count: Post.for_user(id).count,
post_update_count: PostArchive.for_user(id).count,
note_update_count: NoteVersion.for_user(id).count
note_update_count: NoteVersion.where(updater_id: id).count
)
end
end