Sha256: 11780a3ad45a5e7b3f2a9252622f57381625a547f27d48cfc6769d803808fe4d

Contents?: true

Size: 979 Bytes

Versions: 5

Compression:

Stored size: 979 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Debates
    # Notifies users about a new debate. Accepts a Hash in the `extra`
    # field with the key `:type`, which can hold two different values:
    #
    # "user" - The event is being sent to the followers of the debate
    #          author
    # "participatory_space" - The event is being sento to the followers
    #                         of the event's participatory space.
    class CreateDebateEvent < Decidim::Events::SimpleEvent
      include Decidim::Events::AuthorEvent

      def resource_text
        translated_attribute(resource.description)
      end

      private

      def i18n_scope
        @i18n_scope ||= if extra[:type].to_s == "user"
                          "decidim.events.debates.create_debate_event.user_followers"
                        else
                          "decidim.events.debates.create_debate_event.space_followers"
                        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
decidim-debates-0.28.5 app/events/decidim/debates/create_debate_event.rb
decidim-debates-0.28.4 app/events/decidim/debates/create_debate_event.rb
decidim-debates-0.28.3 app/events/decidim/debates/create_debate_event.rb
decidim-debates-0.28.2 app/events/decidim/debates/create_debate_event.rb
decidim-debates-0.28.1 app/events/decidim/debates/create_debate_event.rb