Adding a Column to Enhance Flag Status Reports : How to add column in flag status report?

AI-generated summary

The discussion revolves around adding a ‘Post’ column and including flag type and status (approved, rejected, ignored) to the flag status report dashboard for easier access. omppatil seeks a way to consolidate this information in one place, ideally through Ruby or JavaScript. Moin asks whether a Data Explorer query would suffice, but omppatil confirms the need for a dashboard report. Arkshine suggests modifying the Reports::FlagsStatus class in a plugin, providing code examples to add a ‘Resolution’ column and display the topic title by overwriting the SQL query and adding a new label.

Hi !,
How can we add a ‘Post’ column to identify the specific post that was flagged, and is it possible to include the type of flag used, as well as the status of the flag—whether the post or topic was ignored, rejected, or approved? I’m facing an issue where, if moderator X approves, ignores, or rejects a topic or post, I have to check multiple reports and moderation histories in different places. I would like to consolidate this information in one location. Is there a way in Ruby or JavaScript to add a column to the flag status report? Any help would be appreciated.

Do you need that information as part of the dashboard report, or would a data explorer query that gives you a similar table work too?

I need this information to be part of the dashboard report and displayed on the dashboard for easy access in one location.

Not an expert. I think you have no choice but to overwrite Reports::FlagsStatus in a plugin.

For example, to add a Resolution column, you can do:

  Reports::FlagsStatus.class_eval do
    class_methods do
      alias_method :original_report_flags_status, :report_flags_status

      def report_flags_status(report)
        original_report_flags_status(report)

        report.labels.push(
          {
            type: :text,
            property: :resolution,
            title: "Resolution", # I18n.t(...),
          })
      end
    end
  end

To display the topic tile, you will have to overwrite the SQL query to add it.

And then add a new label, such as:

{
  type: :topic,
  properties: {
    id: :topic_id,
    title: :topic_title,
  },
  title: "Topic Title", # I18n.t(...)
},

Hope that helps.