fixes #2447: Display disapproval counts in status bar to uploader and approvers
This commit is contained in:
@@ -11,6 +11,7 @@ class DailyMaintenance
|
||||
# UserUploadClamper.new.clamp_all!
|
||||
TagSubscription.process_all
|
||||
ApiCacheGenerator.new.generate_tag_cache
|
||||
PostDisapproval.prune!
|
||||
ForumSubscription.process_all!
|
||||
TagAlias.update_cached_post_counts_for_all
|
||||
end
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
class PostDisapproval < ActiveRecord::Base
|
||||
DELETION_THRESHOLD = 1.month
|
||||
|
||||
belongs_to :post
|
||||
belongs_to :user
|
||||
validates_uniqueness_of :post_id, :scope => [:user_id], :message => "have already hidden this post"
|
||||
@@ -10,7 +12,7 @@ class PostDisapproval < ActiveRecord::Base
|
||||
scope :disinterest, lambda {where(:reason => ["disinterest", "legacy"])}
|
||||
|
||||
def self.prune!
|
||||
joins(:post).where("posts.is_pending = FALSE AND posts.is_flagged = FALSE").each do |post_disapproval|
|
||||
PostDisapproval.joins(:post).where("posts.is_pending = FALSE AND posts.is_flagged = FALSE and post_disapprovals.created_at < ?", DELETION_THRESHOLD.ago).each do |post_disapproval|
|
||||
post_disapproval.destroy
|
||||
end
|
||||
end
|
||||
|
||||
13
app/views/post_disapprovals/_counts.html.erb
Normal file
13
app/views/post_disapprovals/_counts.html.erb
Normal file
@@ -0,0 +1,13 @@
|
||||
It has been reviewed by <%= pluralize disapprovals.count, "moderator" %>.
|
||||
|
||||
<% if disapprovals.breaks_rules.count > 0 %>
|
||||
<%= disapprovals.breaks_rules.count %> believe it breaks the rules.
|
||||
<% end %>
|
||||
|
||||
<% if disapprovals.poor_quality.count > 0 %>
|
||||
<%= disapprovals.poor_quality.count %> believe it has poor quality.
|
||||
<% end %>
|
||||
|
||||
<% if disapprovals.disinterest.count > 0 %>
|
||||
<%= disapprovals.disinterest.count %> did not like the post enough to approve it.
|
||||
<% end %>
|
||||
@@ -18,7 +18,11 @@
|
||||
<p>This post was deleted for the following reasons: </p>
|
||||
<%= post_flag_reasons(post) %>
|
||||
<% else %>
|
||||
This post was deleted
|
||||
<p>This post was deleted</p>
|
||||
<% end %>
|
||||
|
||||
<% if post.disapprovals.count > 0 %>
|
||||
<p><%= render "post_disapprovals/counts", :disapprovals => post.disapprovals %></p>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -27,17 +31,7 @@
|
||||
<div class="ui-corner-all ui-state-highlight notice notice-pending" id="pending-approval-notice">
|
||||
<% if post.is_pending? %>
|
||||
This post is pending approval.
|
||||
It has been reviewed by <%= pluralize post.disapprovals.count, "moderator" %>.
|
||||
<% if post.disapprovals.breaks_rules.count > 0 %>
|
||||
<%= post.disapprovals.breaks_rules.count %> believe it breaks the rules.
|
||||
<% end %>
|
||||
<% if post.disapprovals.poor_quality.count > 0 %>
|
||||
<%= post.disapprovals.poor_quality.count %> believe it has poor quality.
|
||||
<% end %>
|
||||
<% if post.disapprovals.disinterest.count > 0 %>
|
||||
<%= post.disapprovals.disinterest.count %> did not like the post enough to approve it.
|
||||
<% end %>
|
||||
|
||||
<%= render "post_disapprovals/counts", :disapprovals => post.disapprovals %>
|
||||
(<%= link_to "learn more", wiki_pages_path(:title => "about:mod_queue") %>)
|
||||
<% else %>
|
||||
This post was flagged and is pending approval (<%= link_to "learn more", wiki_pages_path(:title => "about:mod_queue") %>)
|
||||
|
||||
Reference in New Issue
Block a user