expunge: decrement upload and note/post update counts (fix #2062).
This commit is contained in:
@@ -147,8 +147,6 @@ class Note < ApplicationRecord
|
||||
|
||||
def create_version
|
||||
return unless versioned_attributes_changed?
|
||||
User.where(id: CurrentUser.id).update_all("note_update_count = note_update_count + 1")
|
||||
CurrentUser.reload
|
||||
|
||||
if merge_version?
|
||||
merge_version
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class NoteVersion < ApplicationRecord
|
||||
before_validation :initialize_updater
|
||||
belongs_to :updater, :class_name => "User"
|
||||
belongs_to :updater, :class_name => "User", :counter_cache => "note_update_count"
|
||||
scope :for_user, lambda {|user_id| where("updater_id = ?", user_id)}
|
||||
attr_accessible :note_id, :x, :y, :width, :height, :body, :updater_id, :updater_ip_addr, :is_active, :post_id, :html_id, :version
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ class Post < ApplicationRecord
|
||||
|
||||
belongs_to :updater, :class_name => "User"
|
||||
belongs_to :approver, :class_name => "User"
|
||||
belongs_to :uploader, :class_name => "User"
|
||||
belongs_to :uploader, :class_name => "User", :counter_cache => "post_upload_count"
|
||||
belongs_to :parent, :class_name => "Post"
|
||||
has_one :upload, :dependent => :destroy
|
||||
has_one :artist_commentary, :dependent => :destroy
|
||||
|
||||
@@ -2,7 +2,7 @@ class PostArchive < ApplicationRecord
|
||||
extend Memoist
|
||||
|
||||
belongs_to :post
|
||||
belongs_to :updater, class_name: "User"
|
||||
belongs_to :updater, class_name: "User", counter_cache: "post_update_count"
|
||||
|
||||
def self.enabled?
|
||||
Danbooru.config.aws_sqs_archives_url.present?
|
||||
|
||||
@@ -139,7 +139,6 @@ class Upload < ApplicationRecord
|
||||
post = convert_to_post
|
||||
post.distribute_files
|
||||
if post.save
|
||||
User.where(id: CurrentUser.id).update_all("post_upload_count = post_upload_count + 1")
|
||||
create_artist_commentary(post) if include_artist_commentary?
|
||||
ugoira_service.save_frame_data(post) if is_ugoira?
|
||||
notify_cropper(post)
|
||||
|
||||
Reference in New Issue
Block a user