Skip to content

A platform for community discussion. Free, open, simple.

769 B
Raw Blame
# frozen_string_literal: true

module DiscourseRewind
  module Action
    class BaseReport < Service::ActionBase
      option :user
      option :date

      def self.publicly_visible_topics
        Topic.listable_topics.visible.secured
      end

      def self.publicly_visible_posts
        Post.visible.merge(publicly_visible_topics).where.not(post_type: Post.types[:whisper])
      end

      def self.filter_for_viewer(report, **)
        report
      end

      def self.enabled?
        true
      end

      def self.plugin_enabled?(name)
        Discourse.plugins_by_name[name]&.enabled?
      end

      def should_use_fake_data?
        return false if ENV["DISCOURSE_REWIND_USE_REAL_DATA"] == "1"
        Rails.env.development?
      end
    end
  end
end