Sha256: 76bba32f12c1821a956a76a004d7107269ff422ae35b0b29a178a49271ed2329

Contents?: true

Size: 749 Bytes

Versions: 6

Compression:

Stored size: 749 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Blogs
    module Admin
      # This command is executed when the user creates a Post from the admin
      # panel.
      class CreatePost < Decidim::Commands::CreateResource
        fetch_form_attributes :title, :body, :published_at, :author, :component

        private

        def resource_class = Decidim::Blogs::Post

        def extra_params = { visibility: "all" }

        def run_after_hooks
          Decidim::EventsManager.publish(
            event: "decidim.events.blogs.post_created",
            event_class: Decidim::Blogs::CreatePostEvent,
            resource:,
            followers: resource.participatory_space.followers
          )
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
decidim-blogs-0.29.1 app/commands/decidim/blogs/admin/create_post.rb
decidim-blogs-0.29.0 app/commands/decidim/blogs/admin/create_post.rb
decidim-blogs-0.29.0.rc4 app/commands/decidim/blogs/admin/create_post.rb
decidim-blogs-0.29.0.rc3 app/commands/decidim/blogs/admin/create_post.rb
decidim-blogs-0.29.0.rc2 app/commands/decidim/blogs/admin/create_post.rb
decidim-blogs-0.29.0.rc1 app/commands/decidim/blogs/admin/create_post.rb