Class: Decidim::Admin::ModerationStats
- Inherits:
-
Object
- Object
- Decidim::Admin::ModerationStats
- Defined in:
- app/queries/decidim/admin/moderation_stats.rb
Instance Method Summary collapse
- #content_moderations ⇒ Object
- #count_content_moderations ⇒ Object
- #count_pending_moderations ⇒ Object
- #count_user_pending_reports ⇒ Object
-
#initialize(user) ⇒ ModerationStats
constructor
A new instance of ModerationStats.
- #user_reports ⇒ Object
Constructor Details
#initialize(user) ⇒ ModerationStats
Returns a new instance of ModerationStats.
6 7 8 |
# File 'app/queries/decidim/admin/moderation_stats.rb', line 6 def initialize(user) @user = user end |
Instance Method Details
#content_moderations ⇒ Object
10 11 12 |
# File 'app/queries/decidim/admin/moderation_stats.rb', line 10 def content_moderations @content_moderations ||= Decidim::Moderation.where(participatory_space: spaces_user_is_admin_to) end |
#count_content_moderations ⇒ Object
18 19 20 |
# File 'app/queries/decidim/admin/moderation_stats.rb', line 18 def count_content_moderations content_moderations.not_hidden.count end |
#count_pending_moderations ⇒ Object
26 27 28 |
# File 'app/queries/decidim/admin/moderation_stats.rb', line 26 def count_pending_moderations count_content_moderations + count_user_pending_reports end |
#count_user_pending_reports ⇒ Object
22 23 24 |
# File 'app/queries/decidim/admin/moderation_stats.rb', line 22 def count_user_pending_reports user_reports.unblocked.count end |
#user_reports ⇒ Object
14 15 16 |
# File 'app/queries/decidim/admin/moderation_stats.rb', line 14 def user_reports @user_reports ||= UserModeration.joins(:user).where(decidim_users: { decidim_organization_id: user.decidim_organization_id }) end |