Sha256: d5bdbb61b86341d6412629e5845c8eb98bcd3906a0519b7525f69073c253edfd
Contents?: true
Size: 789 Bytes
Versions: 31
Compression:
Stored size: 789 Bytes
Contents
# frozen_string_literal: true module Decidim module Admin # Creates a newsletter and assigns the right author and # organization. class CreateNewsletter < Rectify::Command # Initializes the command. # # form - The source fo data for this newsletter. # user - The User that authored this newsletter. def initialize(form, user) @form = form @user = user end def call return broadcast(:invalid) unless @form.valid? newsletter = Decidim.traceability.create!( Newsletter, @user, subject: @form.subject, body: @form.body, author: @user, organization: @user.organization ) broadcast(:ok, newsletter) end end end end
Version data entries
31 entries across 31 versions & 1 rubygems