/moderator/dashboard: fix exception when PostArchive isn't enabled.

NoMethodError exception raised

    undefined method `each' for nil:NilClass
    app/views/moderator/dashboards/_activity_tag.html.erb:10:in `_app_views_moderator_dashboards__activity_tag_html_erb__4366063041301266690_47304449138520'
    app/views/moderator/dashboards/show.html.erb:10:in `_app_views_moderator_dashboards_show_html_erb___734721021521262965_47304462731220'
This commit is contained in:
evazion
2017-03-21 17:11:53 -05:00
parent 47ecf034a7
commit 2aa3f9ceba

View File

@@ -5,7 +5,7 @@ module Moderator
attr_reader :user, :count
def self.all(min_date, max_level)
return unless PostArchive.enabled?
return [] unless PostArchive.enabled?
records = PostArchive.where("updated_at > ?", min_date).group(:updater).count.map do |user, count|
new(user, count)