Sha256: 55257b157b5215bccd664ed90a1954aad56152c3a303d57dcb5c10d2f5d058d0

Contents?: true

Size: 834 Bytes

Versions: 33

Compression:

Stored size: 834 Bytes

Contents

# frozen-string_literal: true

module Decidim
  class ResourceHiddenEvent < Decidim::Events::SimpleEvent
    i18n_attributes :resource_path, :report_reasons, :resource_type, :resource_content

    def resource_path
      @resource.reported_content_url
    end

    def resource_url
      @resource.reported_content_url
    end

    def report_reasons
      extra["report_reasons"].map do |reason|
        I18n.t("decidim.admin.moderations.report.reasons.#{reason}").downcase
      end.join(", ")
    end

    def resource_title
      nil
    end

    def resource_content
      translated_attribute(@resource[@resource.reported_attributes.first]).truncate(100, separator: " ")
    end

    def resource_text
      "<i>#{resource_content}</i>"
    end

    def resource_type
      @resource.model_name.human.downcase
    end
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
decidim-admin-0.26.10 app/events/decidim/resource_hidden_event.rb
decidim-admin-0.26.9 app/events/decidim/resource_hidden_event.rb
decidim-admin-0.27.5 app/events/decidim/resource_hidden_event.rb
decidim-admin-0.26.8 app/events/decidim/resource_hidden_event.rb
decidim-admin-0.27.4 app/events/decidim/resource_hidden_event.rb
decidim-admin-0.27.3 app/events/decidim/resource_hidden_event.rb
decidim-admin-0.26.7 app/events/decidim/resource_hidden_event.rb
decidim-admin-0.26.5 app/events/decidim/resource_hidden_event.rb
decidim-admin-0.27.2 app/events/decidim/resource_hidden_event.rb
decidim-admin-0.27.1 app/events/decidim/resource_hidden_event.rb
decidim-admin-0.26.4 app/events/decidim/resource_hidden_event.rb
decidim-admin-0.27.0 app/events/decidim/resource_hidden_event.rb
decidim-admin-0.26.3 app/events/decidim/resource_hidden_event.rb
decidim-admin-0.27.0.rc2 app/events/decidim/resource_hidden_event.rb
decidim-admin-0.27.0.rc1 app/events/decidim/resource_hidden_event.rb
decidim-admin-0.26.2 app/events/decidim/resource_hidden_event.rb
decidim-admin-0.26.1 app/events/decidim/resource_hidden_event.rb
decidim-admin-0.26.0 app/events/decidim/resource_hidden_event.rb
decidim-admin-0.26.0.rc2 app/events/decidim/resource_hidden_event.rb
decidim-admin-0.26.0.rc1 app/events/decidim/resource_hidden_event.rb