remove is_flagged from user limit calculations, deleting a posts now takes it out of pending status
This commit is contained in:
@@ -739,6 +739,7 @@ class Post < ActiveRecord::Base
|
|||||||
|
|
||||||
Post.transaction do
|
Post.transaction do
|
||||||
update_column(:is_deleted, true)
|
update_column(:is_deleted, true)
|
||||||
|
update_column(:is_pending, false)
|
||||||
give_favorites_to_parent
|
give_favorites_to_parent
|
||||||
update_children_on_destroy
|
update_children_on_destroy
|
||||||
update_parent_on_destroy
|
update_parent_on_destroy
|
||||||
|
|||||||
@@ -396,7 +396,7 @@ class User < ActiveRecord::Base
|
|||||||
def upload_limit
|
def upload_limit
|
||||||
deleted_count = Post.for_user(id).deleted.count
|
deleted_count = Post.for_user(id).deleted.count
|
||||||
pending_count = Post.for_user(id).pending.count
|
pending_count = Post.for_user(id).pending.count
|
||||||
approved_count = Post.where("is_flagged = false and is_pending = false and is_deleted = false and uploader_id = ?", id).count
|
approved_count = Post.where("is_pending = false and is_deleted = false and uploader_id = ?", id).count
|
||||||
|
|
||||||
if base_upload_limit
|
if base_upload_limit
|
||||||
limit = base_upload_limit - pending_count
|
limit = base_upload_limit - pending_count
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ class UserPresenter
|
|||||||
|
|
||||||
deleted_count = Post.for_user(user.id).deleted.count
|
deleted_count = Post.for_user(user.id).deleted.count
|
||||||
pending_count = Post.for_user(user.id).pending.count
|
pending_count = Post.for_user(user.id).pending.count
|
||||||
approved_count = Post.where("is_flagged = false and is_pending = false and is_deleted = false and uploader_id = ?", user.id).count
|
approved_count = Post.where("is_pending = false and is_deleted = false and uploader_id = ?", user.id).count
|
||||||
|
|
||||||
if user.base_upload_limit
|
if user.base_upload_limit
|
||||||
limit = user.base_upload_limit - pending_count
|
limit = user.base_upload_limit - pending_count
|
||||||
|
|||||||
Reference in New Issue
Block a user